From: Sage Weil Date: Tue, 22 Jul 2014 20:16:11 +0000 (-0700) Subject: osd/ReplicatedPG: greedily take write_lock for copyfrom finish, snapdir X-Git-Tag: v0.83~5^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6fe27823b8459271bf0c0e807493bb7cf1e4559b;p=ceph.git osd/ReplicatedPG: greedily take write_lock for copyfrom finish, snapdir In the cases where we are taking a write lock and are careful enough that we know we should succeed (i.e, we assert(got)), use the get_write_greedy() variant that skips the checks for waiters (be they ops or backfill) that are normally necessary to avoid starvation. We don't care about staration here because our op is already in-progress and can't easily be aborted, and new ops won't start because they do make those checks. Fixes: #8889 Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3933cd02263..f134830e2ad 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4852,7 +4852,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx) if (pool.info.require_rollback()) ctx->clone_obc->attr_cache = ctx->obc->attr_cache; snap_oi = &ctx->clone_obc->obs.oi; - bool got = ctx->clone_obc->get_write(ctx->op); + bool got = ctx->clone_obc->get_write_greedy(ctx->op); assert(got); } else { snap_oi = &static_snap_oi; @@ -5158,7 +5158,7 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc 0, osd_reqid_t(), ctx->mtime)); ctx->snapset_obc = get_object_context(snapoid, true); - bool got = ctx->snapset_obc->get_write(ctx->op); + bool got = ctx->snapset_obc->get_write_greedy(ctx->op); assert(got); ctx->release_snapset_obc = true; if (pool.info.require_rollback() && !ctx->snapset_obc->obs.exists) {