From: Venky Shankar Date: Wed, 5 Jun 2024 04:55:20 +0000 (+0530) Subject: Merge PR #53301 into wip-vshankar-testing-20240605.045444-debug X-Git-Tag: testing/wip-vshankar-testing-20240605.045444-debug X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=51ff20787a3e0ba9b9abcd6bb3f3da47ec40369e;p=ceph-ci.git Merge PR #53301 into wip-vshankar-testing-20240605.045444-debug * refs/pull/53301/head: qa: adding test for preventing scrub when mds is inactive mds: prevent scrub start for standby-replay MDS Reviewed-by: Milind Changire Reviewed-by: Venky Shankar Reviewed-by: Dhairya Parmar --- 51ff20787a3e0ba9b9abcd6bb3f3da47ec40369e diff --cc src/mds/MDSRank.cc index 2362df5c189,e4807a14f89..9b902aab094 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@@ -2910,31 -2783,55 +2920,41 @@@ void MDSRankDispatcher::handle_asok_com goto out; } + auto respond = new AsyncResponse(f, std::move(on_finish)); finisher->queue( new LambdaContext( - [this, on_finish, f](int r) { - command_scrub_abort( - f, - new LambdaContext( - [on_finish, f](int r) { - bufferlist outbl; - f->open_object_section("result"); - f->dump_int("return_code", r); - f->close_section(); - on_finish(r, {}, outbl); - })); - })); + [this, respond](int r) { + std::lock_guard l(mds_lock); + scrubstack->scrub_abort(respond); + })); 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; } + auto respond = new AsyncResponse(f, std::move(on_finish)); finisher->queue( new LambdaContext( - [this, on_finish, f](int r) { - command_scrub_pause( - f, - new LambdaContext( - [on_finish, f](int r) { - bufferlist outbl; - f->open_object_section("result"); - f->dump_int("return_code", r); - f->close_section(); - on_finish(r, {}, outbl); - })); - })); + [this, respond](int r) { + std::lock_guard l(mds_lock); + scrubstack->scrub_pause(respond); + })); 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;