From ad0ad2d6ef4e17a5b58cf8fadf309d947dc4e28a Mon Sep 17 00:00:00 2001 From: John Spray Date: Tue, 22 Mar 2016 11:54:24 +0000 Subject: [PATCH] mds: enable standby_for_fscid without rank ...so that an MDS can specify that it wants to act within a particular filesystem without having to be bound to a particular rank. Signed-off-by: John Spray --- src/mds/FSMap.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index 9b79bc3f7c29..550f5c5e3a9a 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -477,10 +477,14 @@ mds_gid_t FSMap::find_standby_for(mds_role_t role, const std::string& name) cons || (name.length() && info.standby_for_name == name)) { // It's a named standby for *me*, use it. return gid; - } else if (info.standby_for_rank < 0 && info.standby_for_name.length() == 0) - // It's not a named standby for anyone, use it if we don't find - // a named standby for me later. - result = gid; + } else if ( + info.standby_for_rank < 0 && info.standby_for_name.length() == 0 && + (info.standby_for_fscid == FS_CLUSTER_ID_NONE || + info.standby_for_fscid == role.fscid)) { + // It's not a named standby for anyone, use it if we don't find + // a named standby for me later, unless it targets another FSCID. + result = gid; + } } return result; -- 2.47.3