Skip to content

Commit 525a3be

Browse files
author
neeraj pratap singh
committed
mds: prevent scrub start for standby-replay MDS
Fixes: https://tracker.ceph.com/issues/62537 Signed-off-by: Neeraj Pratap Singh <[email protected]>
1 parent 423a086 commit 525a3be

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/mds/MDSRank.cc

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,7 +2879,12 @@ void MDSRankDispatcher::handle_asok_command(
28792879
r = config_client(client_id, !got_value, option, value, *css);
28802880
} else if (command == "scrub start" ||
28812881
command == "scrub_start") {
2882-
if (whoami != 0) {
2882+
if (!is_active()) {
2883+
*css << "MDS is not active";
2884+
r = -CEPHFS_EINVAL;
2885+
goto out;
2886+
}
2887+
else if (whoami != 0) {
28832888
*css << "Not rank 0";
28842889
r = -CEPHFS_EXDEV;
28852890
goto out;
@@ -2905,7 +2910,12 @@ void MDSRankDispatcher::handle_asok_command(
29052910
}));
29062911
return;
29072912
} else if (command == "scrub abort") {
2908-
if (whoami != 0) {
2913+
if (!is_active()) {
2914+
*css << "MDS is not active";
2915+
r = -CEPHFS_EINVAL;
2916+
goto out;
2917+
}
2918+
else if (whoami != 0) {
29092919
*css << "Not rank 0";
29102920
r = -CEPHFS_EXDEV;
29112921
goto out;
@@ -2920,7 +2930,12 @@ void MDSRankDispatcher::handle_asok_command(
29202930
}));
29212931
return;
29222932
} else if (command == "scrub pause") {
2923-
if (whoami != 0) {
2933+
if (!is_active()) {
2934+
*css << "MDS is not active";
2935+
r = -CEPHFS_EINVAL;
2936+
goto out;
2937+
}
2938+
else if (whoami != 0) {
29242939
*css << "Not rank 0";
29252940
r = -CEPHFS_EXDEV;
29262941
goto out;
@@ -2935,7 +2950,12 @@ void MDSRankDispatcher::handle_asok_command(
29352950
}));
29362951
return;
29372952
} else if (command == "scrub resume") {
2938-
if (whoami != 0) {
2953+
if (!is_active()) {
2954+
*css << "MDS is not active";
2955+
r = -CEPHFS_EINVAL;
2956+
goto out;
2957+
}
2958+
else if (whoami != 0) {
29392959
*css << "Not rank 0";
29402960
r = -CEPHFS_EXDEV;
29412961
goto out;

0 commit comments

Comments
 (0)