Skip to content

Commit

Permalink
SERVER-4328 if a lock is potentially nestable, like the local db lock…
Browse files Browse the repository at this point in the history
…, do it after the "top lock"

otherwise, we could deadlock. this however means we can't commitIfNeeded on that database. the
claim is that that will be ok.
  • Loading branch information
dwight committed Mar 20, 2012
1 parent b7f7403 commit e240ec0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/mongo/db/d_concurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,12 @@ namespace mongo {
if (DB_LEVEL_LOCKING_ENABLED) {
char db[MaxDatabaseNameLen];
nsToDatabase(ns.data(), db);
if( str::equals(db,"local") ) {
lockLocal();
} else {
bool loc = str::equals(db,"local");
if( !loc )
lock(db);
}
lockTop(ls);
if( loc )
lockLocal();
} else {
lock_W();
locked_w = true;
Expand All @@ -584,12 +584,12 @@ namespace mongo {
if (DB_LEVEL_LOCKING_ENABLED) {
char db[MaxDatabaseNameLen];
nsToDatabase(ns.data(), db);
if( str::equals(db,"local") ) {
lockLocal();
} else {
bool loc = str::equals(db,"local");
if( !loc )
lock(db);
}
lockTop(ls);
if( loc )
lockLocal();
} else {
lock_R();
locked_r = true;
Expand Down

0 comments on commit e240ec0

Please sign in to comment.