]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: resend all writes after osdmap loses the full flag
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 6 Dec 2013 01:36:33 +0000 (17:36 -0800)
committerSage Weil <sage@inktank.com>
Mon, 30 Dec 2013 16:49:21 +0000 (08:49 -0800)
Now that the osd does not respond if it gets a map with the full flag
set first, clients need to resend all writes.

Clients talking to old osds are still subject to the race condition,
so both sides must be upgraded to avoid it.

Refs: #6938
Backport: dumpling, emperor
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit e32874fc5aa6f59494766b7bbeb2b6ec3d8f190e)

Conflicts:

src/osdc/Objecter.h

src/osdc/Objecter.cc
src/osdc/Objecter.h

index c193b680e6c11bf7b9b6e739a2914fb1934cfc20..4934dba700eec58ec152625cec3427fc536d8219 100644 (file)
@@ -448,7 +448,8 @@ void Objecter::dispatch(Message *m)
   }
 }
 
-void Objecter::scan_requests(bool skipped_map,
+void Objecter::scan_requests(bool force_resend,
+                            bool force_resend_writes,
                             map<tid_t, Op*>& need_resend,
                             list<LingerOp*>& need_resend_linger,
                             map<tid_t, CommandOp*>& need_resend_command)
@@ -462,8 +463,7 @@ void Objecter::scan_requests(bool skipped_map,
     int r = recalc_linger_op_target(op);
     switch (r) {
     case RECALC_OP_TARGET_NO_ACTION:
-      // resend if skipped map; otherwise do nothing.
-      if (!skipped_map)
+      if (!force_resend && !force_resend_writes)
        break;
       // -- fall-thru --
     case RECALC_OP_TARGET_NEED_RESEND:
@@ -485,8 +485,8 @@ void Objecter::scan_requests(bool skipped_map,
     int r = recalc_op_target(op);
     switch (r) {
     case RECALC_OP_TARGET_NO_ACTION:
-      // resend if skipped map; otherwise do nothing.
-      if (!skipped_map)
+      if (!force_resend &&
+         (!force_resend_writes || !(op->flags & CEPH_OSD_FLAG_WRITE)))
        break;
       // -- fall-thru --
     case RECALC_OP_TARGET_NEED_RESEND:
@@ -509,7 +509,7 @@ void Objecter::scan_requests(bool skipped_map,
     switch (r) {
     case RECALC_OP_TARGET_NO_ACTION:
       // resend if skipped map; otherwise do nothing.
-      if (!skipped_map)
+      if (!force_resend && !force_resend_writes)
        break;
       // -- fall-thru --
     case RECALC_OP_TARGET_NEED_RESEND:
@@ -538,8 +538,9 @@ void Objecter::handle_osd_map(MOSDMap *m)
   }
 
   bool was_pauserd = osdmap->test_flag(CEPH_OSDMAP_PAUSERD);
-  bool was_pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap->test_flag(CEPH_OSDMAP_FULL);
-  
+  bool was_full = osdmap->test_flag(CEPH_OSDMAP_FULL);
+  bool was_pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || was_full;
+
   list<LingerOp*> need_resend_linger;
   map<tid_t, Op*> need_resend;
   map<tid_t, CommandOp*> need_resend_command;
@@ -587,8 +588,10 @@ void Objecter::handle_osd_map(MOSDMap *m)
          continue;
        }
        logger->set(l_osdc_map_epoch, osdmap->get_epoch());
-       
-       scan_requests(skipped_map, need_resend, need_resend_linger, need_resend_command);
+
+       was_full = was_full || osdmap->test_flag(CEPH_OSDMAP_FULL);
+       scan_requests(skipped_map, was_full, need_resend, need_resend_linger,
+                     need_resend_command);
 
        // osd addr changes?
        for (map<int,OSDSession*>::iterator p = osd_sessions.begin();
@@ -612,7 +615,8 @@ void Objecter::handle_osd_map(MOSDMap *m)
        ldout(cct, 3) << "handle_osd_map decoding full epoch " << m->get_last() << dendl;
        osdmap->decode(m->maps[m->get_last()]);
 
-       scan_requests(false, need_resend, need_resend_linger, need_resend_command);
+       scan_requests(false, false, need_resend, need_resend_linger,
+                     need_resend_command);
       } else {
        ldout(cct, 3) << "handle_osd_map hmm, i want a full map, requesting" << dendl;
        monc->sub_want("osdmap", 0, CEPH_SUBSCRIBE_ONETIME);
index 37aa60720e0b052315a27477425ce9c1ec5d8436..ecae3c3c0edefe30491f4e86393b59a92673eecb 100644 (file)
@@ -1211,7 +1211,8 @@ public:
   void set_honor_osdmap_full() { honor_osdmap_full = true; }
   void unset_honor_osdmap_full() { honor_osdmap_full = false; }
 
-  void scan_requests(bool skipped_map,
+  void scan_requests(bool force_resend,
+                    bool force_resend_writes,
                     map<tid_t, Op*>& need_resend,
                     list<LingerOp*>& need_resend_linger,
                     map<tid_t, CommandOp*>& need_resend_command);