Skip to content

Commit e1f0faa

Browse files
authored
Merge pull request ceph#65236 from leonidc/delete_all_gws
nvmeofgw: fix issue of delete all gws from the pool/group
2 parents d1bc769 + 2917409 commit e1f0faa

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
@@ -192,6 +192,26 @@ int NVMeofGwMap::cfg_delete_gw(
192192
return -EINVAL;
193193
}
194194

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

src/mon/NVMeofGwMap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class NVMeofGwMap
6767
const BeaconSubsystems& subs, bool &propose_pending);
6868
int cfg_add_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
6969
int cfg_delete_gw(const NvmeGwId &gw_id, const NvmeGroupKey& group_key);
70+
void check_all_gws_in_deleting_state(const NvmeGwId &gw_id,
71+
const NvmeGroupKey& group_key);
7072
void process_gw_map_ka(
7173
const NvmeGwId &gw_id, const NvmeGroupKey& group_key,
7274
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
@@ -578,6 +578,7 @@ bool NVMeofGwMon::prepare_command(MonOpRequestRef op)
578578
// Simulate immediate Failover of this GW
579579
process_gw_down(id, group_key, propose,
580580
gw_availability_t::GW_UNAVAILABLE);
581+
pending_map.check_all_gws_in_deleting_state(id, group_key);
581582
} else if (rc == -EINVAL) {
582583
dout (4) << "Error: GW not found in the database " << id << " "
583584
<< pool << " " << group << " rc " << rc << dendl;

0 commit comments

Comments
 (0)