From a19cbd3edf147eb130a949df549b0a7dcec9869e Mon Sep 17 00:00:00 2001 From: Xinze Chi Date: Wed, 11 Feb 2015 03:12:09 +0000 Subject: [PATCH 1/2] osd: clear extra get_transaction in do_op get_transaction has been called in execute_ctx Signed-off-by: Xinze Chi --- src/osd/ReplicatedPG.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 93f4f72b88d..cc3186d9a64 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1721,7 +1721,6 @@ void ReplicatedPG::do_op(OpRequestRef& op) } OpContext *ctx = new OpContext(op, m->get_reqid(), m->ops, obc, this); - ctx->op_t = pgbackend->get_transaction(); if (!obc->obs.exists) ctx->snapset_obc = get_object_context(obc->obs.oi.soid.get_snapdir(), false); From 016393dcfae2fcd2b1fc8e51c295f71273b0482b Mon Sep 17 00:00:00 2001 From: Xinze Chi Date: Wed, 11 Feb 2015 10:06:29 +0000 Subject: [PATCH 2/2] osd: call get_transaction if needed in make_writeable Signed-off-by: Xinze Chi --- src/osd/ReplicatedPG.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index cc3186d9a64..2776f19938a 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5470,7 +5470,6 @@ void ReplicatedPG::make_writeable(OpContext *ctx) { const hobject_t& soid = ctx->obs->oi.soid; SnapContext& snapc = ctx->snapc; - PGBackend::PGTransaction *t = pgbackend->get_transaction(); // clone? assert(soid.snap == CEPH_NOSNAP); @@ -5563,7 +5562,13 @@ void ReplicatedPG::make_writeable(OpContext *ctx) snap_oi->snaps = snaps; if (was_dirty) snap_oi->set_flag(object_info_t::FLAG_DIRTY); + + // prepend transaction to op_t + PGBackend::PGTransaction *t = pgbackend->get_transaction(); _make_clone(ctx, t, ctx->clone_obc, soid, coid, snap_oi); + t->append(ctx->op_t); + delete ctx->op_t; + ctx->op_t = t; ctx->delta_stats.num_objects++; if (snap_oi->is_dirty()) @@ -5613,11 +5618,6 @@ void ReplicatedPG::make_writeable(OpContext *ctx) } } - // prepend transaction to op_t - t->append(ctx->op_t); - delete ctx->op_t; - ctx->op_t = t; - // update snapset with latest snap context ctx->new_snapset.seq = snapc.seq; ctx->new_snapset.snaps = snapc.snaps;