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: v15.1.0~257^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f50b87bcb4737befcccf6310aaf522200361e731;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 --- diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 37c28d06b43f..bf01333c3cae 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2384,6 +2384,12 @@ void MDSRankDispatcher::handle_mds_map( if (mdsmap->get_inline_data_enabled() && !oldmap.get_inline_data_enabled()) dout(0) << "WARNING: inline_data support has been deprecated and will be removed in a future release" << dendl; + if (scrubstack->is_scrubbing()) { + if (mdsmap->get_max_mds() > 1) { + auto c = new C_MDSInternalNoop; + scrubstack->scrub_abort(c); + } + } mdcache->handle_mdsmap(*mdsmap); } @@ -2518,6 +2524,16 @@ void MDSRankDispatcher::handle_asok_command( cmd_getval(g_ceph_context, cmdmap, "scrubops", scrubop_vec); cmd_getval(g_ceph_context, cmdmap, "path", path); cmd_getval(g_ceph_context, cmdmap, "tag", tag); + /* if there are more than one mds active and a recursive scrub is requested, + * dishonor the request + */ + bool is_recursive = std::find(scrubop_vec.begin(), scrubop_vec.end(), string("recursive")) != scrubop_vec.end(); + if (mdsmap->get_max_mds() > 1 && is_recursive) { + ss << "There is more than one MDS active. Hence a recursive scrub " + "request cannot be started."; + r = -EINVAL; + goto out; + } finisher->queue( new LambdaContext( [this, on_finish, f, path, tag, scrubop_vec](int r) { diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index 1157e27c1dba..da037cabbab2 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -105,6 +105,8 @@ public: */ std::string_view scrub_summary(); + bool is_scrubbing() const { return !inode_stack.empty(); } + MDCache *mdcache; protected: