summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2018-02-12 10:53:48 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2018-02-13 16:38:53 -0500
commitd3b53c3acae86649f56b44c47258b38e76023457 (patch)
tree96d856863bccd42cd0d363f674c1f85655fbeadd /src/mongo/db/commands
parent91b0a8c599cae1a130f8450e37681b3a134b5dd6 (diff)
downloadmongo-d3b53c3acae86649f56b44c47258b38e76023457.tar.gz
SERVER-33043 Only setFCV should take the fcvLock (ResourceMutex) in exclusive mode
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.h5
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h
index 7634203531e..45a020c4762 100644
--- a/src/mongo/db/commands/feature_compatibility_version.h
+++ b/src/mongo/db/commands/feature_compatibility_version.h
@@ -56,8 +56,11 @@ public:
static constexpr StringData kTargetVersionField = "targetVersion"_sd;
/**
- * Should be taken in exclusive mode by any operations that should not run while
+ * Should be taken in shared mode by any operations that should not run while
* setFeatureCompatibilityVersion is running.
+ *
+ * setFCV takes this lock in exclusive mode so that it both does not run with the shared mode
+ * operations and does not run with itself.
*/
static Lock::ResourceMutex fcvLock;
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index 064a3a42cdd..cfce4a4967b 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -129,6 +129,7 @@ public:
});
// Only allow one instance of setFeatureCompatibilityVersion to run at a time.
+ invariant(!opCtx->lockState()->isLocked());
Lock::ExclusiveLock lk(opCtx->lockState(), FeatureCompatibilityVersion::fcvLock);
const auto requestedVersion = uassertStatusOK(