summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2017-02-06 09:52:30 -0500
committerGeert Bosch <geert@mongodb.com>2017-03-03 18:17:03 -0500
commitb632f0ad5b232aaadd7b9fdf84409d2fbcc1079d (patch)
tree747614bc4875927c5eec66e534f0b5281a97a974
parent41ca3715262d3411bf2dad031318bea92795288a (diff)
downloadmongo-b632f0ad5b232aaadd7b9fdf84409d2fbcc1079d.tar.gz
SERVER-27920 Fix incorrect locking of Client context
(cherry picked from commit ddc34321a7b0019612ee2c093e84cb01b489dd79) Corrected one additional occurrence in in instance.cpp. Conflicts: src/mongo/db/assemble_response.cpp
-rw-r--r--src/mongo/db/commands/distinct.cpp2
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp4
-rw-r--r--src/mongo/db/commands/find_cmd.cpp2
-rw-r--r--src/mongo/db/commands/geo_near_cmd.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp4
-rw-r--r--src/mongo/db/commands/group_cmd.cpp2
-rw-r--r--src/mongo/db/commands/killcursors_cmd.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp2
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp4
-rw-r--r--src/mongo/db/instance.cpp2
-rw-r--r--src/mongo/db/ops/write_ops_exec.cpp10
-rw-r--r--src/mongo/db/query/find.cpp2
12 files changed, 19 insertions, 19 deletions
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index e15c0e4c497..3a93b7e9163 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -220,7 +220,7 @@ public:
}
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(
Explain::getPlanSummary(executor.getValue().get()));
}
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index fed55c1c10b..79ee34203ce 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -427,7 +427,7 @@ public:
std::move(statusWithPlanExecutor.getValue());
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
@@ -533,7 +533,7 @@ public:
std::move(statusWithPlanExecutor.getValue());
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index e86f3aa9cc6..5257cec25db 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -329,7 +329,7 @@ public:
std::unique_ptr<PlanExecutor> exec = std::move(statusWithPlanExecutor.getValue());
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp
index d3f450b3855..28a9e51db19 100644
--- a/src/mongo/db/commands/geo_near_cmd.cpp
+++ b/src/mongo/db/commands/geo_near_cmd.cpp
@@ -247,7 +247,7 @@ public:
auto curOp = CurOp::get(txn);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 9146a2bc00c..709b6b9c76a 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -224,7 +224,7 @@ public:
{
// Set the namespace of the curop back to the view namespace so ctx records
// stats on this view namespace on destruction.
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setNS_inlock(origNss.ns());
}
return retVal;
@@ -331,7 +331,7 @@ public:
auto planSummary = Explain::getPlanSummary(exec);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setPlanSummary_inlock(planSummary);
// Ensure that the original query or command object is available in the slow query log,
diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp
index 88d03549317..66c77ebe6b1 100644
--- a/src/mongo/db/commands/group_cmd.cpp
+++ b/src/mongo/db/commands/group_cmd.cpp
@@ -171,7 +171,7 @@ private:
auto curOp = CurOp::get(txn);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setPlanSummary_inlock(Explain::getPlanSummary(planExecutor.get()));
}
diff --git a/src/mongo/db/commands/killcursors_cmd.cpp b/src/mongo/db/commands/killcursors_cmd.cpp
index 4c85e5f8f99..5831d3b2cc0 100644
--- a/src/mongo/db/commands/killcursors_cmd.cpp
+++ b/src/mongo/db/commands/killcursors_cmd.cpp
@@ -69,7 +69,7 @@ private:
{
// Set the namespace of the curop back to the view namespace so ctx records
// stats on this view namespace on destruction.
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setNS_inlock(nss.ns());
}
return status;
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 04f7a89e32a..ada4edb1f6a 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -1507,7 +1507,7 @@ public:
}
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 45b89e99ede..6fe6de34381 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -431,7 +431,7 @@ public:
{
// Set the namespace of the curop back to the view namespace so ctx records
// stats on this view namespace on destruction.
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setNS_inlock(nss.ns());
}
return status;
@@ -502,7 +502,7 @@ public:
{
auto planSummary = Explain::getPlanSummary(exec.get());
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp->setPlanSummary_inlock(std::move(planSummary));
}
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 3d0e7b10d56..c10d0a3174b 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -465,7 +465,7 @@ bool receivedGetMore(OperationContext* txn, DbResponse& dbresponse, Message& m,
curop.debug().cursorid = cursorid;
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setNS_inlock(ns);
}
diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp
index a1dc9c0ec6f..6ea4d88293a 100644
--- a/src/mongo/db/ops/write_ops_exec.cpp
+++ b/src/mongo/db/ops/write_ops_exec.cpp
@@ -415,7 +415,7 @@ WriteResult performInserts(OperationContext* txn, const InsertOp& wholeOp) {
});
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp.setNS_inlock(wholeOp.ns.ns());
curOp.setLogicalOp_inlock(LogicalOp::opInsert);
curOp.ensureStarted();
@@ -530,7 +530,7 @@ static WriteResult::SingleResult performSingleUpdateOp(OperationContext* txn,
getExecutorUpdate(txn, &curOp.debug(), collection->getCollection(), &parsedUpdate));
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
@@ -576,7 +576,7 @@ WriteResult performUpdates(OperationContext* txn, const UpdateOp& wholeOp) {
Command* cmd = parentCurOp.getCommand();
CurOp curOp(txn);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp.setCommand_inlock(cmd);
}
ON_BLOCK_EXIT([&] { finishCurOp(txn, &curOp); });
@@ -641,7 +641,7 @@ static WriteResult::SingleResult performSingleDeleteOp(OperationContext* txn,
getExecutorDelete(txn, &curOp.debug(), collection.getCollection(), &parsedDelete));
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
CurOp::get(txn)->setPlanSummary_inlock(Explain::getPlanSummary(exec.get()));
}
@@ -683,7 +683,7 @@ WriteResult performDeletes(OperationContext* txn, const DeleteOp& wholeOp) {
Command* cmd = parentCurOp.getCommand();
CurOp curOp(txn);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp.setCommand_inlock(cmd);
}
ON_BLOCK_EXIT([&] { finishCurOp(txn, &curOp); });
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 0f3b27907d9..2fec699721d 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -373,7 +373,7 @@ Message getMore(OperationContext* txn,
auto planSummary = Explain::getPlanSummary(exec);
{
- stdx::lock_guard<Client>(*txn->getClient());
+ stdx::lock_guard<Client> lk(*txn->getClient());
curOp.setPlanSummary_inlock(planSummary);
// Ensure that the original query or command object is available in the slow query log,