From: John Spray Date: Mon, 3 Oct 2016 06:33:27 +0000 (+0100) Subject: mon: don't crash on invalid standby_for_fscid X-Git-Tag: v11.1.0~691^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92fdcf36bd7d57b97f5d887d0370a181860e388c;p=ceph.git mon: don't crash on invalid standby_for_fscid Fixes: http://tracker.ceph.com/issues/17466 Signed-off-by: John Spray --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 85563c5a44d..86d37b5079d 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -2912,6 +2912,17 @@ bool MDSMonitor::maybe_promote_standby(std::shared_ptr 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);