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: v20.0.0~1574^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=525a3beeb71a62c468ee13a01f4c456e4d471871;p=ceph.git mds: prevent scrub start for standby-replay MDS Fixes: https://tracker.ceph.com/issues/62537 Signed-off-by: Neeraj Pratap Singh --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 7f51fe3c683c3..be14deb6e0d3c 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2879,7 +2879,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; @@ -2905,7 +2910,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; @@ -2920,7 +2930,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; @@ -2935,7 +2950,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;