From: Rishabh Dave Date: Wed, 29 Jan 2025 13:06:59 +0000 (+0530) Subject: mon,cephfs: don't disallow "fs fail" when other FS/MDS has health... X-Git-Tag: v20.0.0~19^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0437952c43d9ba4844895741a15f9d56f55899cf;p=ceph.git mon,cephfs: don't disallow "fs fail" when other FS/MDS has health... warnings. Fixes: https://tracker.ceph.com/issues/69707 Signed-off-by: Rishabh Dave --- diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 539c7315b4cc..7f122577a95c 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -108,11 +108,16 @@ class FailHandler : public FileSystemCommandHandler return -ENOENT; } + vector mds_gids_to_fail; + for (const auto& p : fsp->get_mds_map().get_mds_info()) { + mds_gids_to_fail.push_back(p.first); + } + bool confirm = false; cmd_getval(cmdmap, "yes_i_really_mean_it", confirm); if (!confirm && mon->mdsmon()->has_health_warnings({ - MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED})) { + MDS_HEALTH_TRIM, MDS_HEALTH_CACHE_OVERSIZED}, mds_gids_to_fail)) { ss << errmsg_for_unhealthy_mds; return -EPERM; } @@ -122,11 +127,6 @@ class FailHandler : public FileSystemCommandHandler }; fsmap.modify_filesystem(fsp->get_fscid(), std::move(f)); - vector mds_gids_to_fail; - for (const auto& p : fsp->get_mds_map().get_mds_info()) { - mds_gids_to_fail.push_back(p.first); - } - for (const auto& gid : mds_gids_to_fail) { mon->mdsmon()->fail_mds_gid(fsmap, gid); } diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index ba621bc6fb50..897a27653ba8 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1548,7 +1548,7 @@ out: } } -bool MDSMonitor::has_health_warnings(vector warnings, mds_gid_t gid) +bool MDSMonitor::has_health_warnings(vector warnings, const mds_gid_t& gid) { for (auto& [_gid, health] : pending_daemon_health) { if (gid != MDS_GID_NONE) { @@ -1571,6 +1571,17 @@ bool MDSMonitor::has_health_warnings(vector warnings, mds_gid_t gi return false; } +bool MDSMonitor::has_health_warnings(const vector& warnings, + const std::vector& gids) +{ + for (auto& gid : gids) { + if (has_health_warnings(warnings, gid)) { + return true; + } + } + return false; +} + bool MDSMonitor::has_any_health_warning() { return std::any_of( diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 2f667abef8e4..0ba5a2c32dd2 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -53,7 +53,9 @@ class MDSMonitor : public PaxosService, public PaxosFSMap, protected CommandHand bool prepare_update(MonOpRequestRef op) override; bool should_propose(double& delay) override; bool has_health_warnings(std::vector warnings, - mds_gid_t gid=MDS_GID_NONE); + const mds_gid_t& gid=MDS_GID_NONE); + bool has_health_warnings(const std::vector& warnings, + const std::vector& gids); bool has_any_health_warning(); bool should_print_status() const {