From: dparmar18 Date: Mon, 12 Sep 2022 11:46:00 +0000 (+0530) Subject: mds: evaluate strays while performing scrub on root path X-Git-Tag: v17.2.7~192^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fbcc853fc6dc88299409f8a7db08c084aae3039d;p=ceph.git mds: evaluate strays while performing scrub on root path 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 (cherry picked from commit e65eb2bb7895287c068691afe7a7a1710af0d360) --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index e45cb142b7ae..caeaa41cf4af 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -282,7 +282,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"); diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 014ee06317ae..411f7f559d2c 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2961,6 +2961,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; @@ -2968,9 +2969,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! }