From: Milind Changire Date: Fri, 10 Jan 2020 06:31:34 +0000 (+0530) Subject: mds: throttle scrub start for multiple active MDS X-Git-Tag: v14.2.8~63^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c9ec4659462cba9cf5474789c433d970abb57aec;p=ceph.git mds: throttle scrub start for multiple active MDS * add check to "scrub start" command handler to dishonor request if multiple MDS are "active" for a recursive scrub request * add check to MDSRank::handle_mds_map() to see if scrubbing is in progress and max_mds is greater than 1, if so then scrubbing is aborted. This is supposed to take care of the condition when scrubbing has been started with max_mds == 1 and then bumped to a higher value Fixes: https://tracker.ceph.com/issues/43483 Signed-off-by: Milind Changire (cherry picked from commit f50b87bcb4737befcccf6310aaf522200361e731) Conflicts: src/mds/MDSRank.cc src/mds/ScrubStack.h --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index c448f84f427..e99a11233e6 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -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); } @@ -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(); diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index de51ed3fd94..fb3ececd437 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -126,6 +126,8 @@ public: */ 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.