Segfault was triggered by the fs/multifs test.
The problem is in potential undefined behaviour
afer erasing element and iterator invalidation in
FSMap::stop() and FSMap::erase().
Fixed by decoupling element removal from the loop.
Fixes: https://tracker.ceph.com/issues/55620
Signed-off-by: Aliaksei Makarau <aliaksei.makarau@ibm.com>
if (other_info.rank == info.rank
&& other_info.state == MDSMap::STATE_STANDBY_REPLAY) {
standbys.push_back(other_gid);
- erase(other_gid, 0);
}
}
+ for (const auto &other_gid : standbys) {
+ erase(other_gid, 0);
+ }
+
fs->mds_map.mds_info.erase(who);
mds_roles.erase(who);