This would avoid the need to run individual scrubs for
~mdsdir and root, i.e. run both the scrubs under the
same header, this also helps to avoid edge case where
in case ~mdsdir is huge and it's taking time to scrub it,
the scrub status would report something like this until
root inodes kick in:
{
"status": "scrub active (757 inodes in the stack)",
"scrubs": {}
}
Fixes: https://tracker.ceph.com/issues/59350
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit
f85b22818b474911cfdc15e7c6be1d2979939888)
bool is_internal = false;
std::string tag_str(tag);
- C_MDS_EnqueueScrub *cs;
- if ((path == "~mdsdir" && scrub_mdsdir)) {
+ if (tag_str.empty()) {
+ uuid_d uuid_gen;
+ uuid_gen.generate_random();
+ tag_str = uuid_gen.to_string();
is_internal = true;
- cs = new C_MDS_EnqueueScrub(tag_str, f, fin, false);
- } else {
- if (tag_str.empty()) {
- uuid_d uuid_gen;
- uuid_gen.generate_random();
- tag_str = uuid_gen.to_string();
- is_internal = true;
- }
- cs = new C_MDS_EnqueueScrub(tag_str, f, fin);
}
+
+ C_MDS_EnqueueScrub *cs = new C_MDS_EnqueueScrub(tag_str, f, fin);
cs->header = std::make_shared<ScrubHeader>(tag_str, is_internal, force,
recursive, repair, scrub_mdsdir);
}
std::lock_guard l(mds_lock);
- if (scrub_mdsdir) {
- MDSGatherBuilder gather(g_ceph_context);
- mdcache->enqueue_scrub("~mdsdir", "", false, true, false, scrub_mdsdir,
- f, gather.new_sub());
- gather.set_finisher(new C_MDSInternalNoop);
- gather.activate();
- }
mdcache->enqueue_scrub(path, tag, force, recursive, repair, scrub_mdsdir,
f, on_finish);
// scrub_dentry() finishers will dump the data for us; we're done!
<< ", conflicting tag " << header->get_tag() << dendl;
return -CEPHFS_EEXIST;
}
-
+ if (header->get_scrub_mdsdir()) {
+ filepath fp;
+ mds_rank_t rank;
+ rank = mdcache->mds->get_nodeid();
+ if(rank >= 0 && rank < MAX_MDS) {
+ fp.set_path("", MDS_INO_MDSDIR(rank));
+ }
+ int r = _enqueue(mdcache->get_inode(fp.get_ino()), header, true);
+ if (r < 0) {
+ return r;
+ }
+ //to make sure mdsdir is always on the top
+ top = false;
+ }
int r = _enqueue(in, header, top);
if (r < 0)
return r;