From 39e1b65792eb2b88de7df8e03b5bd882c47576b8 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 1 Aug 2016 01:29:14 +0100 Subject: [PATCH] mds: fix daemon selection when starting ranks Previously, if "standby for rank" was set, but "standby for fscid" wasn't, the daemon wouldn't be recognised as the right one for the rank, and we would end up promoting some arbitrary standby. Signed-off-by: John Spray --- src/mds/FSMap.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index bfa97a3d6fd..53899cadc3e 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -541,7 +541,14 @@ mds_gid_t FSMap::find_standby_for(mds_role_t role, const std::string& name) cons continue; } - if ((info.standby_for_rank == role.rank && info.standby_for_fscid == role.fscid) + // The mds_info_t may or may not tell us exactly which filesystem + // the standby_for_rank refers to: lookup via legacy_client_fscid + mds_role_t target_role = { + info.standby_for_fscid == FS_CLUSTER_ID_NONE ? + legacy_client_fscid : info.standby_for_fscid, + info.standby_for_rank}; + + if ((target_role.rank == role.rank && target_role.fscid == role.fscid) || (name.length() && info.standby_for_name == name)) { // It's a named standby for *me*, use it. return gid; -- 2.39.5