From 2fda4c01618f7b5e40cbcad2f20e00e35b58f641 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 13 Dec 2013 13:41:58 -0800 Subject: [PATCH] osd/ReplicatedPG: fix locking for promote After we get the copy-from data and unblock the obc, we still need to take the RWWRITE lock on the object for the duration of the repop while we actually apply the change locally. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 64e354f176a..4f04f64912a 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4901,6 +4901,13 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op, tctx->new_obs.oi.user_version = results->user_version; } + // take RWWRITE lock for duration of our local write + if (!obc->rwstate.get_write_lock()) { + assert(0 == "problem!"); + } + tctx->lock_to_release = OpContext::W_LOCK; + dout(20) << __func__ << " took lock on obc, " << obc->rwstate << dendl; + repop->ondone = new C_KickBlockedObject(obc, this); finish_ctx(tctx); -- 2.47.3