]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: don't crash on invalid standby_for_fscid
authorJohn Spray <john.spray@redhat.com>
Mon, 3 Oct 2016 06:33:27 +0000 (07:33 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 3 Oct 2016 06:42:19 +0000 (07:42 +0100)
Fixes: http://tracker.ceph.com/issues/17466
Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MDSMonitor.cc

index 85563c5a44dcc9f87c681259c8168856701e9679..86d37b5079d65918aba6667a60d1074584cc730b 100644 (file)
@@ -2912,6 +2912,17 @@ bool MDSMonitor::maybe_promote_standby(std::shared_ptr<Filesystem> fs)
             pending_fsmap.legacy_client_fscid : info.standby_for_fscid,
           info.standby_for_rank};
 
+        // It is possible that the map contains a standby_for_fscid
+        // that doesn't correspond to an existing filesystem, especially
+        // if we loaded from a version with a bug (#17466)
+        if (info.standby_for_fscid != FS_CLUSTER_ID_NONE
+            && pending_fsmap.get_filesystems().count(
+              info.standby_for_fscid) == 0) {
+          derr << "gid " << gid << " has invalid standby_for_fscid "
+               << info.standby_for_fscid << dendl;
+          continue;
+        }
+
         // If we managed to resolve a full target role
         if (target_role.fscid != FS_CLUSTER_ID_NONE) {
           auto fs = pending_fsmap.get_filesystem(target_role.fscid);