From 5c2b795724423ed484ab451de855ddcfc085342b Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 19 May 2015 10:56:11 -0700 Subject: [PATCH] ReplicatedPG::finish_ctx: take excl lock if operation is rw Fixes: #11677 Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 4c549a5fd3d..f037cd53bc2 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5741,7 +5741,13 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc if (!ctx->snapset_obc) ctx->snapset_obc = get_object_context(snapoid, true); - bool got = ctx->snapset_obc->get_write_greedy(ctx->op); + bool got = false; + if (ctx->lock_to_release == OpContext::W_LOCK) { + got = ctx->snapset_obc->get_write_greedy(ctx->op); + } else { + assert(ctx->lock_to_release == OpContext::E_LOCK); + got = ctx->snapset_obc->get_excl(ctx->op); + } assert(got); dout(20) << " got greedy write on snapset_obc " << *ctx->snapset_obc << dendl; ctx->release_snapset_obc = true; -- 2.47.3