From d6e6127834a9dec76f07115ef1113c286b4dfbec Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 15 Mar 2021 19:40:51 -0700 Subject: [PATCH] mon: fail standby-replay daemons when flag is turned off This will simplify upgrade procedures. Fixes: https://tracker.ceph.com/issues/49719 Signed-off-by: Patrick Donnelly (cherry picked from commit 131e8841a32dde2b692e13ac31d9d3bab6cdd4a4) --- src/mon/FSCommands.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index a401cc78658..7ea73829106 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -607,6 +607,27 @@ public: return r; } + if (!allow) { + if (!mon->osdmon()->is_writeable()) { + // not allowed to write yet, so retry when we can + mon->osdmon()->wait_for_writeable(op, new PaxosService::C_RetryMessage(mon->mdsmon(), op)); + return -EAGAIN; + } + std::vector to_fail; + for (const auto& [gid, info]: fs->mds_map.get_mds_info()) { + if (info.state == MDSMap::STATE_STANDBY_REPLAY) { + to_fail.push_back(gid); + } + } + + for (const auto& gid : to_fail) { + mon->mdsmon()->fail_mds_gid(fsmap, gid); + } + if (!to_fail.empty()) { + mon->osdmon()->propose_pending(); + } + } + auto f = [allow](auto& fs) { if (allow) { fs->mds_map.set_standby_replay_allowed(); -- 2.47.3