From: Sage Weil Date: Fri, 13 Dec 2013 21:41:58 +0000 (-0800) Subject: osd/ReplicatedPG: fix locking for promote X-Git-Tag: v0.75~45^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2fda4c01618f7b5e40cbcad2f20e00e35b58f641;p=ceph.git 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 --- 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);