Skip to content

Commit 2917409

Browse files
committed
nvmeofgw: fix issue of delete all gws from the pool/group
when gws not removed from the map Signed-off-by: Leonid Chernin <[email protected]>
1 parent eb85a4b commit 2917409

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/mon/NVMeofGwMap.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,26 @@ int NVMeofGwMap::cfg_delete_gw(
190190
return -EINVAL;
191191
}
192192

193+
void NVMeofGwMap::check_all_gws_in_deleting_state(const NvmeGwId &gw_id,
194+
const NvmeGroupKey& group_key) {
195+
for (auto& gws_states: created_gws[group_key]) {
196+
auto& state = gws_states.second;
197+
if (state.availability != gw_availability_t::GW_DELETING) {
198+
return;
199+
}
200+
}
201+
dout(5) << "all gws in DELETING state, remove them from the map: pool/group "
202+
<< group_key << dendl;
203+
/* Monitor have to force remove GWs because otherwise all GW will stay forever
204+
* in DELETING state - no beacons from the group and monitor cannot update
205+
* number namespaces in each group so delete condition newer turns true.
206+
*/
207+
for (auto& gws_states: created_gws[group_key]) {
208+
do_delete_gw(gws_states.first, group_key);
209+
}
210+
return;
211+
}
212+
193213
int NVMeofGwMap::do_erase_gw_id(const NvmeGwId &gw_id,
194214
const NvmeGroupKey& group_key) {
195215

src/mon/NVMeofGwMap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class NVMeofGwMap
6666
const BeaconSubsystems& subs, bool &propose_pending);
6767
int cfg_add_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
6868
int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
69+
void check_all_gws_in_deleting_state(const NvmeGwId &gw_id,
70+
const NvmeGroupKey& group_key);
6971
void process_gw_map_ka(
7072
const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
7173
epoch_t& last_osd_epoch, bool &propose_pending);

src/mon/NVMeofGwMon.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op)
560560
// Simulate immediate Failover of this GW
561561
process_gw_down(id, group_key, propose,
562562
gw_availability_t::GW_UNAVAILABLE);
563+
pending_map.check_all_gws_in_deleting_state(id, group_key);
563564
} else if (rc == -EINVAL) {
564565
dout (4) << "Error: GW not found in the database " << id << " "
565566
<< pool << " " << group << " rc " << rc << dendl;

0 commit comments

Comments
 (0)