diff options
Diffstat (limited to 'src/mongo/s/d_state.cpp')
-rw-r--r-- | src/mongo/s/d_state.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp index c70ca52ea55..8b7d8990d18 100644 --- a/src/mongo/s/d_state.cpp +++ b/src/mongo/s/d_state.cpp @@ -48,6 +48,7 @@ #include "mongo/db/commands.h" #include "mongo/db/jsobj.h" #include "mongo/db/db.h" +#include "mongo/db/operation_context_impl.h" #include "mongo/db/wire_version.h" #include "mongo/db/repl/is_master.h" #include "mongo/client/connpool.h" @@ -60,7 +61,6 @@ #include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/ticketholder.h" -using namespace std; namespace mongo { @@ -558,7 +558,8 @@ namespace mongo { { // DBLock needed since we're now potentially changing the metadata, and don't want // reads/writes to be ongoing. - Lock::DBWrite writeLk( ns ); + OperationContextImpl txn; + Lock::DBWrite writeLk(txn.lockState(), ns ); // // Get the metadata now that the load has completed @@ -1183,10 +1184,12 @@ namespace mongo { virtual bool isWriteCommandForConfigServer() const { return false; } - virtual Status checkAuthForCommand(ClientBasic* client, + virtual Status checkAuthForCommand(OperationContext* txn, + ClientBasic* client, const std::string& dbname, const BSONObj& cmdObj) { if (!client->getAuthorizationSession()->isAuthorizedForActionsOnResource( + txn, ResourcePattern::forExactNamespace(NamespaceString(parseNs(dbname, cmdObj))), ActionType::getShardVersion)) { return Status(ErrorCodes::Unauthorized, "Unauthorized"); @@ -1241,7 +1244,7 @@ namespace mongo { } bool run(OperationContext* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { - Lock::DBWrite dbXLock(dbname); + Lock::DBWrite dbXLock(txn->lockState(), dbname); Client::Context ctx(dbname); shardingState.appendInfo( result ); |