From 9bf51f9f0d3a17f4da54816c342c3da7823c0606 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Sat, 3 Dec 2016 18:12:31 -0800 Subject: [PATCH] ReplicatedPG: add return value to RepGather Now that repops can represent an error, we need to remember the error code so that we can reply to waiting_for_* messages with the right value. Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 13 +++++++++---- src/osd/ReplicatedPG.h | 14 ++++++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 26c5b14d0af..c37c6c567d4 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2353,7 +2353,8 @@ void ReplicatedPG::record_write_error(OpRequestRef op, const hobject_t &soid, osd->send_message_osd_client(reply, m->get_connection()); } ), - op + op, + r ); } @@ -8508,7 +8509,7 @@ void ReplicatedPG::eval_repop(RepGather *repop) waiting_for_ondisk[repop->v].begin(); i != waiting_for_ondisk[repop->v].end(); ++i) { - osd->reply_op_error(i->first, 0, repop->v, + osd->reply_op_error(i->first, repop->r, repop->v, i->second); } waiting_for_ondisk.erase(repop->v); @@ -8657,6 +8658,7 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop( boost::intrusive_ptr ReplicatedPG::new_repop( eversion_t version, + int r, ObcLockManager &&manager, OpRequestRef &&op, boost::optional > &&on_complete) @@ -8667,7 +8669,8 @@ boost::intrusive_ptr ReplicatedPG::new_repop( std::move(on_complete), osd->get_tid(), info.last_complete, - true); + true, + r); repop->v = version; repop->start = ceph_clock_now(cct); @@ -8723,7 +8726,8 @@ void ReplicatedPG::submit_log_entries( const mempool::osd::list &entries, ObcLockManager &&manager, boost::optional > &&_on_complete, - OpRequestRef op) + OpRequestRef op, + int r) { dout(10) << __func__ << " " << entries << dendl; assert(is_primary()); @@ -8739,6 +8743,7 @@ void ReplicatedPG::submit_log_entries( if (get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) { repop = new_repop( version, + r, std::move(manager), std::move(op), std::move(_on_complete)); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index c621e2d2b48..ebf8a46d394 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -645,6 +645,7 @@ public: int nref; eversion_t v; + int r = 0; ceph_tid_t rep_tid; @@ -690,10 +691,12 @@ public: boost::optional > &&on_complete, ceph_tid_t rt, eversion_t lc, - bool applies_with_commit) : + bool applies_with_commit, + int r) : op(o), queue_item(this), nref(1), + r(r), rep_tid(rt), rep_aborted(false), rep_done(false), all_applied(false), all_committed(false), @@ -836,6 +839,7 @@ protected: ceph_tid_t rep_tid); boost::intrusive_ptr new_repop( eversion_t version, + int r, ObcLockManager &&manager, OpRequestRef &&op, boost::optional > &&on_complete); @@ -854,7 +858,8 @@ protected: const mempool::osd::list &entries, ObcLockManager &&manager, boost::optional > &&on_complete, - OpRequestRef op = OpRequestRef()); + OpRequestRef op = OpRequestRef(), + int r = 0); struct LogUpdateCtx { boost::intrusive_ptr repop; set waiting_on; @@ -1635,8 +1640,9 @@ inline ostream& operator<<(ostream& out, const ReplicatedPG::RepGather& repop) << " " << repop.v << " rep_tid=" << repop.rep_tid << " committed?=" << repop.all_committed - << " applied?=" << repop.all_applied; - out << ")"; + << " applied?=" << repop.all_applied + << " r=" << repop.r + << ")"; return out; } -- 2.39.5