]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add assertions for standby_daemons invariant 10316/head
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 16 Jul 2016 03:29:22 +0000 (23:29 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Sat, 16 Jul 2016 17:31:00 +0000 (13:31 -0400)
These assertions catch state changes of an mds in standby_daemons to a state
other than MDSMap::STATE_STANDBY. Currently this invariant is (sometimes!)
checked in other locations on access of standby_daemons. This commit allows us
catch the violated invariant at the time it occurred.

Related to: http://tracker.ceph.com/issues/16592

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/FSMap.cc
src/mds/FSMap.h

index 55c72f2addcd4bc89871f513c4372a28c51e303f..bfa97a3d6fd7efe87ea544e297e80b9b7ad3aa2d 100644 (file)
@@ -787,6 +787,8 @@ bool FSMap::undamaged(const fs_cluster_id_t fscid, const mds_rank_t rank)
 
 void FSMap::insert(const MDSMap::mds_info_t &new_info)
 {
+  assert(new_info.state == MDSMap::STATE_STANDBY);
+  assert(new_info.rank == MDS_RANK_NONE);
   mds_roles[new_info.global_id] = FS_CLUSTER_ID_NONE;
   standby_daemons[new_info.global_id] = new_info;
   standby_epochs[new_info.global_id] = epoch;
index d14e365a652a8406f131702673b06442266dc7c6..5bf27838be6eb20e850fa93a2de12d248582f14c 100644 (file)
@@ -311,7 +311,9 @@ public:
       std::function<void(MDSMap::mds_info_t *info)> fn)
   {
     if (mds_roles.at(who) == FS_CLUSTER_ID_NONE) {
-      fn(&standby_daemons.at(who));
+      auto &info = standby_daemons.at(who);
+      fn(&info);
+      assert(info.state == MDSMap::STATE_STANDBY);
       standby_epochs[who] = epoch;
     } else {
       auto fs = filesystems[mds_roles.at(who)];