From: Leonid Chernin Date: Tue, 26 Aug 2025 12:34:32 +0000 (+0300) Subject: nvmeofgw: fix issue of delete all gws from the pool/group X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92b6201b02082df625c435ef3167d68873a71585;p=ceph.git nvmeofgw: fix issue of delete all gws from the pool/group when gws not removed from the map Signed-off-by: Leonid Chernin (cherry picked from commit 29174099ac46d19f6dd5dd9375a2a8c606dccd17) --- diff --git a/src/mon/NVMeofGwMap.cc b/src/mon/NVMeofGwMap.cc index 4b3fb2c676bb..a2ed42f04c83 100755 --- a/src/mon/NVMeofGwMap.cc +++ b/src/mon/NVMeofGwMap.cc @@ -190,6 +190,26 @@ int NVMeofGwMap::cfg_delete_gw( return -EINVAL; } +void NVMeofGwMap::check_all_gws_in_deleting_state(const NvmeGwId &gw_id, + const NvmeGroupKey& group_key) { + for (auto& gws_states: created_gws[group_key]) { + auto& state = gws_states.second; + if (state.availability != gw_availability_t::GW_DELETING) { + return; + } + } + dout(5) << "all gws in DELETING state, remove them from the map: pool/group " + << group_key << dendl; + /* Monitor have to force remove GWs because otherwise all GW will stay forever + * in DELETING state - no beacons from the group and monitor cannot update + * number namespaces in each group so delete condition newer turns true. + */ + for (auto& gws_states: created_gws[group_key]) { + do_delete_gw(gws_states.first, group_key); + } + return; +} + int NVMeofGwMap::do_erase_gw_id(const NvmeGwId &gw_id, const NvmeGroupKey& group_key) { diff --git a/src/mon/NVMeofGwMap.h b/src/mon/NVMeofGwMap.h index 015577f248ad..36e29817ea94 100755 --- a/src/mon/NVMeofGwMap.h +++ b/src/mon/NVMeofGwMap.h @@ -66,6 +66,8 @@ public: const BeaconSubsystems& subs, bool &propose_pending); int cfg_add_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key); int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key); + void check_all_gws_in_deleting_state(const NvmeGwId &gw_id, + const NvmeGroupKey& group_key); void process_gw_map_ka( const NvmeGwId &gw_id, const NvmeGroupKey& group_key, epoch_t& last_osd_epoch, bool &propose_pending); diff --git a/src/mon/NVMeofGwMon.cc b/src/mon/NVMeofGwMon.cc index f34479a7333f..e69058b67c94 100644 --- a/src/mon/NVMeofGwMon.cc +++ b/src/mon/NVMeofGwMon.cc @@ -647,6 +647,7 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op) // Simulate immediate Failover of this GW process_gw_down(id, group_key, propose, gw_availability_t::GW_UNAVAILABLE); + pending_map.check_all_gws_in_deleting_state(id, group_key); } else if (rc == -EINVAL) { dout (4) << "Error: GW not found in the database " << id << " " << pool << " " << group << " rc " << rc << dendl;