Skip to content

Commit 5815655

Browse files
committed
mds: scrub pins more inodes than the mds_cache_memory_limit
For scrubbing dirfrag we are pushing children back into the scrub stack. Instead we can follow the same strategy for scrub directory and pushing children front of the scrub stack, and in kick_off_scrubs always start scrubbing from the front of the stack. It will prevent ScrubStack to pinning whole level of the file-system tree. Fixes: https://tracker.ceph.com/issues/71167 Signed-off-by: Md Mahamudur Rahaman Sajib <[email protected]>
1 parent 943ce0c commit 5815655

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎src/mds/ScrubStack.cc‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,16 @@ void ScrubStack::kick_off_scrubs()
308308
}
309309
}
310310
} else if (CDir *dir = dynamic_cast<CDir*>(*it)) {
311-
auto next = it;
312-
++next;
311+
++it;
312+
bool added_children = false;
313313
bool done = false; // it's done, so pop it off the stack
314-
scrub_dirfrag(dir, &done);
314+
scrub_dirfrag(dir, &added_children, &done);
315315
if (done) {
316-
dout(20) << __func__ << " dirfrag, done" << dendl;
317-
++it; // child inodes were queued at bottom of stack
318-
dequeue(dir);
319-
} else {
320-
it = next;
316+
dout(20) << __func__ << " dirfrag, done" << dendl;
317+
dequeue(dir);
318+
}
319+
if (added_children) {
320+
it = scrub_stack.begin();
321321
}
322322
} else {
323323
ceph_assert(0 == "dentry in scrub stack");
@@ -501,7 +501,7 @@ void ScrubStack::identify_remote_link_damage(CDentry *dn) {
501501
}
502502
}
503503

504-
void ScrubStack::scrub_dirfrag(CDir *dir, bool *done)
504+
void ScrubStack::scrub_dirfrag(CDir *dir, bool *added_children, bool *done)
505505
{
506506
ceph_assert(dir != NULL);
507507

@@ -540,7 +540,8 @@ void ScrubStack::scrub_dirfrag(CDir *dir, bool *done)
540540
continue;
541541
}
542542
if (dnl->is_primary()) {
543-
_enqueue(dnl->get_inode(), header, false);
543+
*added_children = true;
544+
_enqueue(dnl->get_inode(), header, true);
544545
} else if (dnl->is_remote() || dnl->is_referent_remote()) {
545546
identify_remote_link_damage(dn);
546547
}

‎src/mds/ScrubStack.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,10 @@ class ScrubStack {
242242
* scrub of the dirfrag.
243243
*
244244
* @param dir The dirfrag to scrub (must be auth)
245+
* @param added_children set to true if we pushed some of our children
245246
* @param done set to true if we started to do final scrub
246247
*/
247-
void scrub_dirfrag(CDir *dir, bool *done);
248+
void scrub_dirfrag(CDir *dir, bool *added_children, bool *done);
248249
/**
249250
* Scrub a directory-representing dentry.
250251
*

0 commit comments

Comments
 (0)