]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: identify damaged hard links during scrub
authorsajibreadd <sajibreadd@gmail.com>
Thu, 24 Apr 2025 13:23:40 +0000 (15:23 +0200)
committerVenky Shankar <vshankar@redhat.com>
Fri, 26 Sep 2025 05:07:55 +0000 (10:37 +0530)
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>
src/mds/ScrubStack.cc
src/mds/ScrubStack.h

index 9c401f14aab72b327df6c61e44565cf4d6bc1a6b..6b5e914f518844ac0032e0f50ae26db41bc98885 100644 (file)
@@ -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);
       }
     }
   }
index a8b7e870dbf9784615f9c7cfd671e9f0a108b562..ac14f8e8d2a1e17742f5a14ce21bd0ef6376456d 100644 (file)
@@ -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