Skip to content

Commit a83787b

Browse files
sajibreaddvshankar
authored andcommitted
mds: identify damaged hard links during scrub
For a remote link, try to open the dentry (this part of code is copied from the mds path_traversal) which internally pushes the dir_frag in the damage list if applicable. Fixes: https://tracker.ceph.com/issues/69345 Signed-off-by: Md Mahamudur Rahaman Sajib <[email protected]>
1 parent 96f5aef commit a83787b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/mds/ScrubStack.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,19 @@ void ScrubStack::scrub_dir_inode_final(CInode *in)
487487
return;
488488
}
489489

490+
void ScrubStack::identify_remote_link_damage(CDentry *dn) {
491+
492+
CDentry::linkage_t *dnl = dn->get_linkage();
493+
CInode *remote_inode = mdcache->get_inode(dnl->get_remote_ino());
494+
if (!remote_inode) {
495+
if (mdcache->mds->damage_table.is_remote_damaged(dnl->get_remote_ino())) {
496+
dout(4) << "scrub: remote dentry points to damaged ino " << *dn << dendl;
497+
return;
498+
}
499+
mdcache->open_remote_dentry(dn, true, new C_MDSInternalNoop());
500+
}
501+
}
502+
490503
void ScrubStack::scrub_dirfrag(CDir *dir, bool *done)
491504
{
492505
ceph_assert(dir != NULL);
@@ -530,7 +543,7 @@ void ScrubStack::scrub_dirfrag(CDir *dir, bool *done)
530543
if (dnl->is_primary()) {
531544
_enqueue(dnl->get_inode(), header, false);
532545
} else if (dnl->is_remote() || dnl->is_referent_remote()) {
533-
// TODO: check remote linkage
546+
identify_remote_link_damage(dn);
534547
}
535548
}
536549
}

src/mds/ScrubStack.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ class ScrubStack {
212212
*/
213213
void scrub_file_inode(CInode *in);
214214

215+
/**
216+
* Scrub a file inode.
217+
* @param dn The remote dentry to identify
218+
*/
219+
void identify_remote_link_damage(CDentry *dn);
220+
215221
/**
216222
* Callback from completion of CInode::validate_disk_state
217223
* @param in The inode we were validating

0 commit comments

Comments
 (0)