]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: identify damaged hard links during scrub
authorsajibreadd <sajibreadd@gmail.com>
Thu, 24 Apr 2025 13:23:40 +0000 (15:23 +0200)
committersajibreadd <sajibreadd@gmail.com>
Tue, 7 Oct 2025 08:06:12 +0000 (10:06 +0200)
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 <mahamudur.sajib@croit.io>
(cherry picked from commit a83787b5a85bb30a087cbe9843cfe35018f6c94d)

Conflicts:
src/mds/ScrubStack.cc

src/mds/ScrubStack.cc
src/mds/ScrubStack.h

index 63f18adf7a313ac43c591805ced1287b2053c905..28e5c1dc869eb7e70e5c4e976ff23c257dd69b16 100644 (file)
@@ -414,6 +414,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);
@@ -457,7 +470,7 @@ void ScrubStack::scrub_dirfrag(CDir *dir, bool *done)
       if (dnl->is_primary()) {
        _enqueue(dnl->get_inode(), header, false);
       } else if (dnl->is_remote()) {
-       // TODO: check remote linkage
+        identify_remote_link_damage(dn);
       }
     }
   }
index a2ed3d5a89abff6f12e01fd522ebad31df77be5f..eb47b9309b44664ef4d1e90c9a037f2926cccdb6 100644 (file)
@@ -188,6 +188,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