From: sajibreadd Date: Thu, 24 Apr 2025 13:23:40 +0000 (+0200) Subject: mds: identify damaged hard links during scrub X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a83787b5a85bb30a087cbe9843cfe35018f6c94d;p=ceph.git 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 --- diff --git a/src/mds/ScrubStack.cc b/src/mds/ScrubStack.cc index 9c401f14aab72..6b5e914f51884 100644 --- a/src/mds/ScrubStack.cc +++ b/src/mds/ScrubStack.cc @@ -487,6 +487,19 @@ void ScrubStack::scrub_dir_inode_final(CInode *in) return; } +void ScrubStack::identify_remote_link_damage(CDentry *dn) { + + CDentry::linkage_t *dnl = dn->get_linkage(); + CInode *remote_inode = mdcache->get_inode(dnl->get_remote_ino()); + if (!remote_inode) { + if (mdcache->mds->damage_table.is_remote_damaged(dnl->get_remote_ino())) { + dout(4) << "scrub: remote dentry points to damaged ino " << *dn << dendl; + return; + } + mdcache->open_remote_dentry(dn, true, new C_MDSInternalNoop()); + } +} + void ScrubStack::scrub_dirfrag(CDir *dir, bool *done) { ceph_assert(dir != NULL); @@ -530,7 +543,7 @@ void ScrubStack::scrub_dirfrag(CDir *dir, bool *done) if (dnl->is_primary()) { _enqueue(dnl->get_inode(), header, false); } else if (dnl->is_remote() || dnl->is_referent_remote()) { - // TODO: check remote linkage + identify_remote_link_damage(dn); } } } diff --git a/src/mds/ScrubStack.h b/src/mds/ScrubStack.h index a8b7e870dbf97..ac14f8e8d2a1e 100644 --- a/src/mds/ScrubStack.h +++ b/src/mds/ScrubStack.h @@ -212,6 +212,12 @@ private: */ void scrub_file_inode(CInode *in); + /** + * Scrub a file inode. + * @param dn The remote dentry to identify + */ + void identify_remote_link_damage(CDentry *dn); + /** * Callback from completion of CInode::validate_disk_state * @param in The inode we were validating