]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: don't write transaction when inc crc failed
authorDan van der Ster <daniel.vanderster@cern.ch>
Mon, 27 Jul 2020 15:40:27 +0000 (17:40 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 29 Jul 2020 04:30:34 +0000 (06:30 +0200)
80da5f9a987c6a48b93f25228fdac85890013520 exposed a flaw in how
handle_osd_map falls back to a full osdmap if the crc of an incremental
failed.

If the first message in a map message had a crc error, then the
loop would exit with last < start, which would then cause a null
dereference in _committed_osd_maps.

Fixes: https://tracker.ceph.com/issues/46443
Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
(cherry picked from commit 99463cb523949289384a6210ea250114fbe852f4)

src/osd/OSD.cc

index 3cb99c685bd78dc5b4d11d1ec8c2abc2a4378df9..5e6064e0ef6861b20fe60c210c459419b5acbe4f 100644 (file)
@@ -8429,6 +8429,13 @@ void OSD::handle_osd_map(MOSDMap *m)
        delete o;
        request_full_map(e, last);
        last = e - 1;
+
+       // don't continue committing if we failed to enc the first inc map
+       if (last < start) {
+         dout(10) << __func__ << " bailing because last < start (" << last << "<" << start << ")" << dendl;
+         m->put();
+         return;
+       }
        break;
       }
       got_full_map(e);
@@ -8549,10 +8556,12 @@ void OSD::_committed_osd_maps(epoch_t first, epoch_t last, MOSDMap *m)
   }
   map_lock.get_write();
 
+  ceph_assert(first <= last);
+
   bool do_shutdown = false;
   bool do_restart = false;
   bool network_error = false;
-  OSDMapRef osdmap;
+  OSDMapRef osdmap = get_osdmap();
 
   // advance through the new maps
   for (epoch_t cur = first; cur <= last; cur++) {