]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Merge PR #53301 into wip-vshankar-testing-20240605.045444-debug testing/wip-vshankar-testing-20240605.045444-debug
authorVenky Shankar <vshankar@redhat.com>
Wed, 5 Jun 2024 04:55:20 +0000 (10:25 +0530)
committerVenky Shankar <vshankar@redhat.com>
Wed, 5 Jun 2024 04:55:20 +0000 (10:25 +0530)
* 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 <mchangir@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Dhairya Parmar <dparmar@redhat.com>
1  2 
qa/tasks/cephfs/test_scrub_checks.py
src/mds/MDSRank.cc

Simple merge
index 2362df5c189ef7946be0edddc5f47ff218ea8d79,e4807a14f89205b1282299c4e3f9955416ad345e..9b902aab094567fcc0e55a28722eee0545045a38
@@@ -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;