From e32e2559c8ff408fff81cce0f15d6601dcd4a2f7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Jul 2014 13:16:11 -0700 Subject: [PATCH] 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 (cherry picked from commit 6fe27823b8459271bf0c0e807493bb7cf1e4559b) --- src/osd/ReplicatedPG.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 15d2edfd40909..c2b289c1cb922 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4854,7 +4854,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; @@ -5160,7 +5160,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) { -- 2.39.5