]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: fix locking for promote
authorSage Weil <sage@inktank.com>
Fri, 13 Dec 2013 21:41:58 +0000 (13:41 -0800)
committerSage Weil <sage@inktank.com>
Fri, 20 Dec 2013 00:40:00 +0000 (16:40 -0800)
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 <sage@inktank.com>
src/osd/ReplicatedPG.cc

index 64e354f176a1e229ef28f27a78ca8a5ef113f12f..4f04f64912ad0655e9ed12941e3e764601aef086 100644 (file)
@@ -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);