]> 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)
committerDan van der Ster <daniel.vanderster@cern.ch>
Tue, 28 Jul 2020 21:15:42 +0000 (23:15 +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>
src/osd/OSD.cc

index 3856294f8ed6ebf04fd79ab5f6eb66e963a7b190..d9889daf695abb76eebc0ac9dca22cceb306fef1 100644 (file)
@@ -7949,6 +7949,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);
@@ -8081,10 +8088,12 @@ void OSD::_committed_osd_maps(epoch_t first, epoch_t last, MOSDMap *m)
   }
   map_lock.lock();
 
+  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++) {