From: Samuel Just Date: Fri, 13 Nov 2015 18:37:45 +0000 (-0800) Subject: ReplicatedPG: move do_osd_op_effects out of eval_repop X-Git-Tag: v10.1.0~277^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=90a5359b9cb78f0b3b5669e5e89047663f7449b6;p=ceph.git ReplicatedPG: move do_osd_op_effects out of eval_repop This is better anyway, do_osd_op_effects on a non-client op was somewhat silly without an op (even if you filled in the other fields like watch_connects, it would just silently skip it). It also eliminates another dependence of RepGather on OpContext. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a75c363b974..9ac78392997 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -3013,6 +3013,13 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) ctx->op->mark_commit_sent(); } }); + ctx->register_on_success( + [ctx, this]() { + do_osd_op_effects( + ctx, + ctx->op ? ctx->op->get_req()->get_connection() : + ConnectionRef()); + }); // issue replica writes ceph_tid_t rep_tid = osd->get_tid(); @@ -6384,8 +6391,8 @@ void ReplicatedPG::do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn) // disconnects first complete_disconnect_watches(ctx->obc, ctx->watch_disconnects); - if (!conn) - return; + assert(conn); + boost::intrusive_ptr session((OSD::Session *)conn->get_priv()); if (!session.get()) return; @@ -8320,11 +8327,6 @@ void ReplicatedPG::eval_repop(RepGather *repop) if (repop->all_applied && repop->all_committed) { repop->rep_done = true; - do_osd_op_effects( - repop->ctx, - repop->ctx->op ? repop->ctx->op->get_req()->get_connection() : - ConnectionRef()); - calc_min_last_complete_ondisk(); for (auto p = repop->on_success.begin(); @@ -8612,8 +8614,13 @@ void ReplicatedPG::handle_watch_timeout(WatchRef watch) oi.watchers.erase(make_pair(watch->get_cookie(), watch->get_entity())); - ctx->watch_disconnects.push_back( - OpContext::watch_disconnect_t(watch->get_cookie(), watch->get_entity(), true)); + list watch_disconnects = { + watch_disconnect_t(watch->get_cookie(), watch->get_entity(), true) + }; + ctx->register_on_success( + [this, obc, watch_disconnects]() { + complete_disconnect_watches(obc, watch_disconnects); + }); PGBackend::PGTransaction *t = ctx->op_t;