]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon,cephfs: don't disallow "fs fail" when other FS/MDS has health...
authorRishabh Dave <ridave@redhat.com>
Wed, 29 Jan 2025 13:06:59 +0000 (18:36 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 6 Feb 2025 16:33:19 +0000 (22:03 +0530)
warnings.

Fixes: https://tracker.ceph.com/issues/69707
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/mon/FSCommands.cc
src/mon/MDSMonitor.cc
src/mon/MDSMonitor.h

index 539c7315b4ccca8e8fab3a3e2315f3cbcaa45d9b..7f122577a95cf6e7db14fe6f067165387ab4fece 100644 (file)
@@ -108,11 +108,16 @@ class FailHandler : public FileSystemCommandHandler
       return -ENOENT;
     }
 
+    vector<mds_gid_t> 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_gid_t> 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);
     }
index ba621bc6fb50f524791662ef9a222b6302aed9b1..897a27653ba8965073ed12d5730302b7d237fce6 100644 (file)
@@ -1548,7 +1548,7 @@ out:
   }
 }
 
-bool MDSMonitor::has_health_warnings(vector<mds_metric_t> warnings, mds_gid_t gid)
+bool MDSMonitor::has_health_warnings(vector<mds_metric_t> 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<mds_metric_t> warnings, mds_gid_t gi
   return false;
 }
 
+bool MDSMonitor::has_health_warnings(const vector<mds_metric_t>& warnings,
+                                    const std::vector<mds_gid_t>& 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(
index 2f667abef8e49a94934463e5b43ee5818fcfd14f..0ba5a2c32dd234d30eabec58b5b3d932efccf472 100644 (file)
@@ -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<mds_metric_t> warnings,
-                          mds_gid_t gid=MDS_GID_NONE);
+                          const mds_gid_t& gid=MDS_GID_NONE);
+  bool has_health_warnings(const std::vector<mds_metric_t>& warnings,
+                          const std::vector<mds_gid_t>& gids);
   bool has_any_health_warning();
 
   bool should_print_status() const {