diff options
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r-- | src/mongo/db/introspect.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index c2f11b34e6d..c84a1caafa0 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -135,10 +135,11 @@ namespace { BufBuilder profileBufBuilder(1024); try { - // NOTE: It's kind of weird that we lock the op's namespace, but have to for now since - // we're sometimes inside the lock already - Lock::DBWrite lk(txn->lockState(), currentOp.getNS() ); - if (dbHolder().get(txn, nsToDatabase(currentOp.getNS())) != NULL) { + // NOTE: It's kind of weird that we lock the op's namespace, but have to for now + // since we're sometimes inside the lock already + const string dbname(nsToDatabase(currentOp.getNS())); + Lock::DBLock lk(txn->lockState(), dbname, newlm::MODE_X); + if (dbHolder().get(txn, dbname) != NULL) { // We are ok with the profiling happening in a different WUOW from the actual op. WriteUnitOfWork wunit(txn); Client::Context cx(txn, currentOp.getNS(), false); |