From: neeraj pratap singh Date: Tue, 5 Sep 2023 11:13:39 +0000 (+0530) Subject: mds: prevent scrub start for standby-replay MDS X-Git-Tag: v18.2.5~525^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=710fe4b302bab70f9b38b6081d49a9ef844df0bc;p=ceph.git mds: prevent scrub start for standby-replay MDS Fixes: https://tracker.ceph.com/issues/62537 Signed-off-by: Neeraj Pratap Singh (cherry picked from commit 525a3beeb71a62c468ee13a01f4c456e4d471871) --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 2aff4800b846..9b9714ad2e23 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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;