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;