From 865c1e2372b01c4232a972f733bf1eccfce65017 Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Sun, 24 Dec 2023 14:16:12 +0000 Subject: [PATCH] mon/OSDMonitor: fix osd_epochs insertion on prepare_beacon() Previously, an OSD marked out could have been added back to the map upon new beacon sent by the OSD. If the OSD goes down (after being added back to map) - it won't be marked as OUT again. Therefore, `osd_epochs` would remain with a "stale" OSD, as a result OSDMonitor::get_min_last_epoch_clean() will always return the "stale" OSD epoch. When osd is marked out, it will be erased from `osd_epochs` map. Correspondingly, it should be added back to the map **only** once it's marked in. Fixes: https://tracker.ceph.com/issues/63883 Signed-off-by: Matan Breizman (cherry picked from commit dd1d30b7b209eaff376620ebd6b9a65df5ee7361) --- src/mon/OSDMonitor.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 360bd036bf9..511f2f7ff27 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -4443,8 +4443,9 @@ bool OSDMonitor::prepare_beacon(MonOpRequestRef op) last_osd_report[from].first = ceph_clock_now(); last_osd_report[from].second = beacon->osd_beacon_report_interval; - osd_epochs[from] = beacon->version; - + if (osdmap.is_in(from)) { + osd_epochs[from] = beacon->version; + } for (const auto& pg : beacon->pgs) { if (auto* pool = osdmap.get_pg_pool(pg.pool()); pool != nullptr) { unsigned pg_num = pool->get_pg_num(); -- 2.39.5