]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::finish_ctx: take excl lock if operation is rw
authorSamuel Just <sjust@redhat.com>
Tue, 19 May 2015 17:56:11 +0000 (10:56 -0700)
committerAbhishek Lekshmanan <abhishek.lekshmanan@ril.com>
Mon, 8 Jun 2015 17:49:35 +0000 (23:19 +0530)
Fixes: #11677
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 5c2b795724423ed484ab451de855ddcfc085342b)

src/osd/ReplicatedPG.cc

index 37b2f51ad82088068930b036ab68ccd97a5829f3..ce7a5dfb1f0d002225d743de14635915bc553350 100644 (file)
@@ -5711,7 +5711,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;