Merge pull request #53670 from mchangir/mds-enqueue-all-child-frags-for-scrub-for-a-given-fragset

mds/scrub: enqueue all child frags for a given fragset

Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Rishabh Dave <ridave@redhat.com>
This commit is contained in:
Rishabh Dave 2024-01-16 17:46:08 +05:30 committed by GitHub
commit e283219800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -891,22 +891,30 @@ void ScrubStack::handle_scrub(const cref_t<MMDSScrub> &m)
std::vector<CDir*> dfs;
MDSGatherBuilder gather(g_ceph_context);
frag_vec_t frags;
diri->dirfragtree.get_leaves(frags);
for (const auto& fg : m->get_frags()) {
CDir *dir = diri->get_dirfrag(fg);
if (!dir) {
dout(10) << __func__ << " no frag " << fg << dendl;
continue;
for (auto f : frags) {
if (!fg.contains(f)) {
dout(20) << __func__ << " skipping " << f << dendl;
continue;
}
CDir *dir = diri->get_or_open_dirfrag(mdcache, f);
if (!dir) {
dout(10) << __func__ << " no frag " << f << dendl;
continue;
}
if (!dir->is_auth()) {
dout(10) << __func__ << " not auth " << *dir << dendl;
continue;
}
if (!dir->can_auth_pin()) {
dout(10) << __func__ << " can't auth pin " << *dir << dendl;
dir->add_waiter(CDir::WAIT_UNFREEZE, gather.new_sub());
continue;
}
dfs.push_back(dir);
}
if (!dir->is_auth()) {
dout(10) << __func__ << " not auth " << *dir << dendl;
continue;
}
if (!dir->can_auth_pin()) {
dout(10) << __func__ << " can't auth pin " << *dir << dendl;
dir->add_waiter(CDir::WAIT_UNFREEZE, gather.new_sub());
continue;
}
dfs.push_back(dir);
}
if (gather.has_subs()) {