]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: evaluate strays while performing scrub on root path
authordparmar18 <dparmar@redhat.com>
Mon, 12 Sep 2022 11:46:00 +0000 (17:16 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Fri, 3 Mar 2023 06:14:55 +0000 (11:44 +0530)
Running scrub at CephFS root doesn't iterate over ~mdsdir,
this feature is needed but the cluster admin should have
the liberty to decide whether to evaluate strays at root
or not. Therefore a new option 'scrub_mdsdir' can be useful.

Fixes: https://tracker.ceph.com/issues/53724
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSRank.cc

index 80caf1499e8591f63e1e1205cf64f740a0118329..65d7eba79e57890ed83d7140cc3d7fd2b6e3b1be 100644 (file)
@@ -286,7 +286,7 @@ void MDSDaemon::set_up_admin_socket()
   ceph_assert(r == 0);
   r = admin_socket->register_command("scrub start "
                                     "name=path,type=CephString "
-                                    "name=scrubops,type=CephChoices,strings=force|recursive|repair,n=N,req=false "
+                                    "name=scrubops,type=CephChoices,strings=force|recursive|repair|scrub_mdsdir,n=N,req=false "
                                     "name=tag,type=CephString,req=false",
                                     asok_hook,
                                     "scrub and inode and output results");
index 888a0062e2043e3bc737260f1dd87181fe1045f8..edebe5503d69c69354f69c69ce25209c68c80fec 100644 (file)
@@ -2972,6 +2972,7 @@ void MDSRank::command_scrub_start(Formatter *f,
   bool force = false;
   bool recursive = false;
   bool repair = false;
+  bool scrub_mdsdir = false;
   for (auto &op : scrubop_vec) {
     if (op == "force")
       force = true;
@@ -2979,9 +2980,17 @@ void MDSRank::command_scrub_start(Formatter *f,
       recursive = true;
     else if (op == "repair")
       repair = true;
+    else if (op == "scrub_mdsdir" && path == "/")
+      scrub_mdsdir = true;
   }
 
   std::lock_guard l(mds_lock);
+  if (scrub_mdsdir) {
+    MDSGatherBuilder gather(g_ceph_context);
+    mdcache->enqueue_scrub("~mdsdir", tag, false, true, false, f, gather.new_sub());
+    gather.set_finisher(new C_MDSInternalNoop);
+    gather.activate();
+  }
   mdcache->enqueue_scrub(path, tag, force, recursive, repair, f, on_finish);
   // scrub_dentry() finishers will dump the data for us; we're done!
 }