From 9ee03d452530dacf12237d14dbda3616b2b49a6a Mon Sep 17 00:00:00 2001 From: Dan van der Ster Date: Mon, 27 Jul 2020 17:40:27 +0200 Subject: [PATCH] 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 (cherry picked from commit 99463cb523949289384a6210ea250114fbe852f4) --- src/osd/OSD.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3cb99c685bd78..5e6064e0ef686 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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++) { -- 2.39.5