]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
nvmeofgw: cleanup pending map upon monitor restart
authorLeonid Chernin <leonidc@il.ibm.com>
Tue, 5 Aug 2025 10:19:59 +0000 (13:19 +0300)
committerLeonid Chernin <leonidc@il.ibm.com>
Tue, 16 Sep 2025 12:07:28 +0000 (15:07 +0300)
fixes https://tracker.ceph.com/issues/72434

Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
(cherry picked from commit 924acd1f2c11784790abb2b9c5ff5dacd32934e1)

src/mon/NVMeofGwMon.cc
src/mon/NVMeofGwMon.h

index dcf154674f99dc0f2a2bbdf291a6628520cc7d66..342631f7a7136ffa6e37d5f49f4537bc89555697 100644 (file)
@@ -29,11 +29,21 @@ void NVMeofGwMon::init()
   dout(10) <<  "called " << dendl;
 }
 
+void NVMeofGwMon::cleanup_pending_map()
+{
+  dout(10) << "cleanup pending :" << pending_map  << dendl;
+  pending_map.created_gws.clear();
+  pending_map.fsm_timers.clear();
+  pending_map.gw_epoch.clear();
+  pending_map.epoch = 0;
+}
+
 void NVMeofGwMon::on_restart()
 {
   dout(10) <<  "called " << dendl;
   last_beacon.clear();
   last_tick = ceph::coarse_mono_clock::now();
+  cleanup_pending_map();
   synchronize_last_beacon();
 }
 
@@ -168,6 +178,11 @@ void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
     NvmeGwMonStates& gw_created_map = created_map_pair.second;
     for (auto& gw_created_pair: gw_created_map) {
       auto gw_id = gw_created_pair.first;
+      auto& pending_gws_states = pending_map.created_gws[group_key];
+      auto  gw_state = pending_gws_states.find(gw_id);
+      if (gw_state == pending_gws_states.end()) {
+        continue;
+      }
       if (gw_created_pair.second.allow_failovers_ts > now) {
         // restore not persistent information upon new epochs
         dout(10) << " restore skip-failovers timeout for gw  " << gw_id  << dendl;
index 2eceeaee3a77dd204e31b519217900f9efa1f03d..1c4617e37230e930d58a409faae1367ebbb3571e 100644 (file)
@@ -99,6 +99,7 @@ private:
   epoch_t get_ack_map_epoch(bool gw_created, const NvmeGroupKey& group_key);
   void recreate_gw_epoch();
   void restore_pending_map_info(NVMeofGwMap & tmp_map);
+  void cleanup_pending_map();
 };
 
 #endif /* MON_NVMEGWMONITOR_H_ */