]> 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)
committerSamuel Just <sjust@redhat.com>
Fri, 29 May 2015 21:09:05 +0000 (14:09 -0700)
Fixes: #11677
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ReplicatedPG.cc

index 4c549a5fd3d39bbaca0b7adc821744054b473115..f037cd53bc2493a60d8dc6ecfdb51a4c8c6c8ade 100644 (file)
@@ -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;