]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: throttle scrub start for multiple active MDS
authorMilind Changire <mchangir@redhat.com>
Fri, 10 Jan 2020 06:31:34 +0000 (12:01 +0530)
committerMilind Changire <mchangir@redhat.com>
Fri, 10 Jan 2020 06:31:34 +0000 (12:01 +0530)
* 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 <mchangir@redhat.com>
src/mds/MDSRank.cc
src/mds/ScrubStack.h

index 37c28d06b43f1de21673ccbc510227cac977fa56..bf01333c3cae78d82033b38bbe4fdffb2d258780 100644 (file)
@@ -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) {
index 1157e27c1dbaa9aeaff92753d17c63d52e34c3c5..da037cabbab2541042e46a4aee5b763334c9ec73 100644 (file)
@@ -105,6 +105,8 @@ public:
    */
   std::string_view scrub_summary();
 
+  bool is_scrubbing() const { return !inode_stack.empty(); }
+
   MDCache *mdcache;
 
 protected: