From 0591f01568bb321735c68f8232b348c4937075d5 Mon Sep 17 00:00:00 2001 From: Enming Zhang Date: Wed, 13 Dec 2017 22:32:32 +0800 Subject: [PATCH] PrimaryLogPG: define soid just before using it Define the soid just before using it to avoid a redundant definition if an error happens and function prepare_transaction returns directly. Signed-off-by: Enming Zhang --- src/osd/PrimaryLogPG.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 3f75eb5d443..a658abfbf5b 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -7756,8 +7756,6 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx) { assert(!ctx->ops->empty()); - const hobject_t& soid = ctx->obs->oi.soid; - // valid snap context? if (!ctx->snapc.is_valid()) { dout(10) << " invalid snapc " << ctx->snapc << dendl; @@ -7808,6 +7806,7 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx) } } + const hobject_t& soid = ctx->obs->oi.soid; // clone, if necessary if (soid.snap == CEPH_NOSNAP) make_writeable(ctx); -- 2.39.5