Skip to content

Commit

Permalink
Merge pull request ceph#32602 from batrick/i43558
Browse files Browse the repository at this point in the history
nautilus: mds: reject forward scrubs when cluster has multiple active MDS (more than one rank)

Reviewed-by: Ramana Raja <rraja@redhat.com>
  • Loading branch information
yuriw committed Feb 11, 2020
2 parents 0e34ed8 + 3f7f0c7 commit 9b2c28a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/mds/MDSRank.cc
Expand Up @@ -2401,6 +2401,12 @@ void MDSRankDispatcher::handle_mds_map(
purge_queue.update_op_limit(*mdsmap);
}

if (scrubstack->is_scrubbing()) {
if (mdsmap->get_max_mds() > 1) {
auto c = new C_MDSInternalNoop;
scrubstack->scrub_abort(c);
}
}
mdcache->handle_mdsmap(*mdsmap);
}

Expand Down Expand Up @@ -2516,6 +2522,12 @@ bool MDSRankDispatcher::handle_asok_command(std::string_view command,
cmd_getval(g_ceph_context, cmdmap, "scrubops", scrubop_vec);
cmd_getval(g_ceph_context, cmdmap, "path", path);

/* Multiple MDS scrub is not currently supported. See also: https://tracker.ceph.com/issues/12274 */
if (mdsmap->get_max_mds() > 1) {
ss << "Scrub is not currently supported for multiple active MDS. Please reduce max_mds to 1 and then scrub.";
return true;
}

C_SaferCond cond;
command_scrub_start(f, path, "", scrubop_vec, &cond);
cond.wait();
Expand Down Expand Up @@ -3598,6 +3610,13 @@ bool MDSRankDispatcher::handle_command(
cmd_getval(g_ceph_context, cmdmap, "path", path);
cmd_getval(g_ceph_context, cmdmap, "tag", tag);

/* Multiple MDS scrub is not currently supported. See also: https://tracker.ceph.com/issues/12274 */
if (mdsmap->get_max_mds() > 1) {
*ss << "Scrub is not currently supported for multiple active MDS. Please reduce max_mds to 1 and then scrub.";
*r = ENOTSUP;
return true;
}

*need_reply = false;
*run_later = create_async_exec_context(new C_ScrubExecAndReply
(this, m, path, tag, scrubop_vec));
Expand Down
2 changes: 2 additions & 0 deletions src/mds/ScrubStack.h
Expand Up @@ -126,6 +126,8 @@ class ScrubStack {
*/
void scrub_status(Formatter *f);

bool is_scrubbing() const { return !inode_stack.empty(); }

private:
// scrub abort is _not_ a state, rather it's an operation that's
// performed after in-progress scrubs are finished.
Expand Down

0 comments on commit 9b2c28a

Please sign in to comment.