]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: prevent scrub start for standby-replay MDS
authorneeraj pratap singh <neerajpratapsingh@li-ff7f0d4c-3462-11b2-a85c-d4004c0fa1a0.ibm.com>
Tue, 5 Sep 2023 11:13:39 +0000 (16:43 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 10 Jul 2024 04:05:44 +0000 (09:35 +0530)
Fixes: https://tracker.ceph.com/issues/62537
Signed-off-by: Neeraj Pratap Singh <neesingh@redhat.com>
(cherry picked from commit 525a3beeb71a62c468ee13a01f4c456e4d471871)

src/mds/MDSRank.cc

index 2aff4800b8463824a93607e1dd0cdfdddc503e4c..9b9714ad2e23907118e2c39a8065d17a9153d374 100644 (file)
@@ -2735,7 +2735,12 @@ void MDSRankDispatcher::handle_asok_command(
     r = config_client(client_id, !got_value, option, value, *css);
   } else if (command == "scrub start" ||
             command == "scrub_start") {
-    if (whoami != 0) {
+    if (!is_active()) {
+      *css << "MDS is not active";
+      r = -CEPHFS_EINVAL;
+      goto out;
+    }
+    else if (whoami != 0) {
       *css << "Not rank 0";
       r = -CEPHFS_EXDEV;
       goto out;
@@ -2761,7 +2766,12 @@ void MDSRankDispatcher::handle_asok_command(
        }));
     return;
   } else if (command == "scrub abort") {
-    if (whoami != 0) {
+    if (!is_active()) {
+      *css << "MDS is not active";
+      r = -CEPHFS_EINVAL;
+      goto out;
+    }
+    else if (whoami != 0) {
       *css << "Not rank 0";
       r = -CEPHFS_EXDEV;
       goto out;
@@ -2783,7 +2793,12 @@ void MDSRankDispatcher::handle_asok_command(
        }));
     return;
   } else if (command == "scrub pause") {
-    if (whoami != 0) {
+    if (!is_active()) {
+      *css << "MDS is not active";
+      r = -CEPHFS_EINVAL;
+      goto out;
+    }
+    else if (whoami != 0) {
       *css << "Not rank 0";
       r = -CEPHFS_EXDEV;
       goto out;
@@ -2805,7 +2820,12 @@ void MDSRankDispatcher::handle_asok_command(
        }));
     return;
   } else if (command == "scrub resume") {
-    if (whoami != 0) {
+    if (!is_active()) {
+      *css << "MDS is not active";
+      r = -CEPHFS_EINVAL;
+      goto out;
+    }
+    else if (whoami != 0) {
       *css << "Not rank 0";
       r = -CEPHFS_EXDEV;
       goto out;