]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/fsmap: proper update of filesystems 46371/head
authorAliaksei Makarau <aliaksei.makarau@ibm.com>
Tue, 31 May 2022 07:24:19 +0000 (09:24 +0200)
committerAliaksei Makarau <aliaksei.makarau@ibm.com>
Tue, 31 May 2022 07:24:19 +0000 (09:24 +0200)
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>
src/mds/FSMap.cc

index 217a1e3307c544abd6d0589902212f2e00b724be..b9ae05ac0f62246831f30ed0d7ed6c9d0df8b1ae 100644 (file)
@@ -1090,10 +1090,13 @@ std::vector<mds_gid_t> FSMap::stop(mds_gid_t who)
     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);