summaryrefslogtreecommitdiff
path: root/src/mongo/db/introspect.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-01-20 11:40:42 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-01-20 17:07:06 -0500
commit403a992daa205f2b43469ef45b5008d817a38fb6 (patch)
tree222c4db089330a33ce26c2a77010d28db55a67dd /src/mongo/db/introspect.cpp
parent37398ff1063d8a42d075822ead009e761703fb9d (diff)
downloadmongo-403a992daa205f2b43469ef45b5008d817a38fb6.tar.gz
SERVER-16923 Create the system.profile collection if under DB X lock
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r--src/mongo/db/introspect.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp
index f90dec52159..a43e92edc66 100644
--- a/src/mongo/db/introspect.cpp
+++ b/src/mongo/db/introspect.cpp
@@ -94,7 +94,9 @@ namespace {
AuthorizationSession * authSession = txn->getClient()->getAuthorizationSession();
_appendUserInfo(*txn->getCurOp(), b, authSession);
- BSONObj p = b.done();
+ const BSONObj p = b.done();
+
+ const bool wasLocked = txn->lockState()->isLocked();
const string dbName(nsToDatabase(txn->getCurOp()->getNS()));
@@ -132,7 +134,8 @@ namespace {
break;
}
- else if (!acquireDbXLock && !txn->lockState()->isLocked()) {
+ else if (!acquireDbXLock &&
+ (!wasLocked || txn->lockState()->isDbLockedForMode(dbName, MODE_X))) {
// Try to create the collection only if we are not under lock, in order to
// avoid deadlocks due to lock conversion. This would only be hit if someone
// deletes the profiler collection after setting profile level.