]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: add return value to RepGather 12305/head
authorSamuel Just <sjust@redhat.com>
Sun, 4 Dec 2016 02:12:31 +0000 (18:12 -0800)
committerSamuel Just <sjust@redhat.com>
Sun, 4 Dec 2016 02:27:47 +0000 (18:27 -0800)
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 <sjust@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 26c5b14d0af42b58f643082da000308208be46fb..c37c6c567d4cdd9af4a92bb70e1e3fa189fa8c48 100644 (file)
@@ -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::RepGather> ReplicatedPG::new_repop(
   eversion_t version,
+  int r,
   ObcLockManager &&manager,
   OpRequestRef &&op,
   boost::optional<std::function<void(void)> > &&on_complete)
@@ -8667,7 +8669,8 @@ boost::intrusive_ptr<ReplicatedPG::RepGather> 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<pg_log_entry_t> &entries,
   ObcLockManager &&manager,
   boost::optional<std::function<void(void)> > &&_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));
index c621e2d2b485cf6d92d61ca39be4e62f2a21b760..ebf8a46d39479d14f37ce977cde8d6f380c7a251 100644 (file)
@@ -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<std::function<void(void)> > &&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<RepGather> new_repop(
     eversion_t version,
+    int r,
     ObcLockManager &&manager,
     OpRequestRef &&op,
     boost::optional<std::function<void(void)> > &&on_complete);
@@ -854,7 +858,8 @@ protected:
     const mempool::osd::list<pg_log_entry_t> &entries,
     ObcLockManager &&manager,
     boost::optional<std::function<void(void)> > &&on_complete,
-    OpRequestRef op = OpRequestRef());
+    OpRequestRef op = OpRequestRef(),
+    int r = 0);
   struct LogUpdateCtx {
     boost::intrusive_ptr<RepGather> repop;
     set<pg_shard_t> 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;
 }