From 6f55f11f4700224d71c65d0b7f3dc69f0a40990a Mon Sep 17 00:00:00 2001 From: neeraj pratap singh Date: Tue, 5 Sep 2023 16:43:39 +0530 Subject: [PATCH] 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) --- src/mds/MDSRank.cc | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 9fd50b477de..b3137a44a5d 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; -- 2.39.5