From: Dan van der Ster Date: Mon, 27 Jul 2020 15:40:27 +0000 (+0200) Subject: osd: don't write transaction when inc crc failed X-Git-Tag: v16.1.0~1605^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99463cb523949289384a6210ea250114fbe852f4;p=ceph.git osd: don't write transaction when inc crc failed 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3856294f8ed..d9889daf695 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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++) {