From: Leonid Chernin Date: Sun, 7 Jun 2026 05:26:38 +0000 (+0300) Subject: nvmeofgw: stretched cluster fix relocate X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4770952270afa9188b4163ee746fbd9bb0d39a2c;p=ceph.git nvmeofgw: stretched cluster fix relocate fixes: https://tracker.ceph.com/issues/77803 Signed-off-by: Leonid Chernin --- diff --git a/src/mon/NVMeofGwMap.cc b/src/mon/NVMeofGwMap.cc index b72dc3e898b..494983b5a4e 100644 --- a/src/mon/NVMeofGwMap.cc +++ b/src/mon/NVMeofGwMap.cc @@ -818,7 +818,9 @@ void NVMeofGwMap::handle_abandoned_ana_groups(bool& propose) void NVMeofGwMap::check_relocate_ana_groups(const NvmeGroupKey& group_key, bool &propose) { - /* if location in disaster_locations found in recovering state state - find all gws in location. + /* loop for all locations: + * if location in normal state or "disaster_locations" + * found in recovering state state - find all gws in location. * add ana-grp of not Available gws to the list. * if ana-grp is already active on some gw in location skip it * for ana-grp in list make relocation. @@ -830,48 +832,57 @@ void NVMeofGwMap::check_relocate_ana_groups(const NvmeGroupKey& group_key, return ; } std::list reloc_list; + std::unordered_set locations_set; auto& gws_states = created_gws[group_key]; - FailbackLocation location; - if (get_location_in_disaster_cleanup(group_key, location)) { - uint32_t num_gw_in_location = 0; - uint32_t num_active_ana_in_location = 0; - for (auto& gw_state : gws_states) { // loop for GWs inside group-key - NvmeGwMonState& state = gw_state.second; - if (state.location == location) { - num_gw_in_location ++; - if (state.availability != gw_availability_t::GW_AVAILABLE) { - reloc_list.push_back(state.ana_grp_id); - } else { // in parallel check condition to complete failback-in-process - for (auto& state_it: state.sm_state) { - if (state_it.second == gw_states_per_group_t::GW_ACTIVE_STATE) { - num_active_ana_in_location ++; + for (auto& gw_state : gws_states) {// build locations set + locations_set.insert(gw_state.second.location); + } + for (NvmeLocation location : locations_set) { + bool cleanup_in_process; + reloc_list.clear(); + bool disaster = is_location_in_disaster(group_key, location, cleanup_in_process); + if ((disaster && cleanup_in_process) || (!disaster)) { + uint32_t num_gw_in_location = 0; + uint32_t num_active_ana_in_location = 0; + for (auto& gw_state : gws_states) { // loop for GWs inside group-key + NvmeGwMonState& state = gw_state.second; + if (state.location == location) { + num_gw_in_location++; + if (state.availability != gw_availability_t::GW_AVAILABLE) { + reloc_list.push_back(state.ana_grp_id); + } else { // in parallel check condition to complete failback-in-process + for (auto& state_it: state.sm_state) { + if (state_it.second == gw_states_per_group_t::GW_ACTIVE_STATE) { + num_active_ana_in_location ++; + } } } } } - } - if (num_gw_in_location == num_active_ana_in_location) {// All ana groups of disaster location are in Active - disaster_map_remove_location(group_key, location); - dout(4) << "the location entry is erased "<< location - << " from disaster-locations num_ana_groups in location " - << num_gw_in_location - << " from the failbacks-in-progress of group " << group_key <