From: John Spray Date: Tue, 21 Feb 2017 15:51:47 +0000 (+0000) Subject: mon: fix stale iterator during fs rm X-Git-Tag: v12.0.1~238^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5fd66839bb8be57541bff2c7fd58dcd31a2bdabb;p=ceph.git mon: fix stale iterator during fs rm We were failing out any standbys in the map for the removed filesystem, while looping over the mds_info -- this could have crashed. Signed-off-by: John Spray --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 693bf0d5e36e1..b48ee11a25efa 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -551,13 +551,17 @@ class RemoveFilesystemHandler : public FileSystemCommandHandler fsmap.set_legacy_client_fscid(FS_CLUSTER_ID_NONE); } + std::vector to_fail; // There may be standby_replay daemons left here for (const auto &i : fs->mds_map.get_mds_info()) { assert(i.second.state == MDSMap::STATE_STANDBY_REPLAY); + to_fail.push_back(i.first); + } + for (const auto &gid : to_fail) { // Standby replays don't write, so it isn't important to // wait for an osdmap propose here: ignore return value. - mon->mdsmon()->fail_mds_gid(i.first); + mon->mdsmon()->fail_mds_gid(gid); } fsmap.erase_filesystem(fs->fscid);