Whamcloud - gitweb
LU-8574 osd-ldiskfs: fix FID-in-dirent properly 10/22310/5
authorFan Yong <fan.yong@intel.com>
Thu, 14 Jul 2016 02:11:54 +0000 (10:11 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 25 Oct 2016 02:20:27 +0000 (02:20 +0000)
commitc3947b14e5fa88b25d4e2a8e1c44b27d6397d814
treef77894c8358998e3296f6d4f99782b3f50529d2f
parent48488fa271e4444e4a2ab4f3babb6c91b779634e
LU-8574 osd-ldiskfs: fix FID-in-dirent properly

Sometimes, the directory entry may be corrupted and contains bad
ino# information as to point to the inode that belong to other.
Two cases for that:

1) If such inode is unless, then the up layer namespace LFSCK may
   handle it as dangling name entry (by guess), and as the LFSCK
   progressing, its original inode (orphan) may be found then the
   LFSCK will fix the such bad name entry to reference the orphan.

2) If such inode is used by other, then osd_dirent_check_repair()
   will find that the FID-in-dirent does not match the FID-in-LMA,
   and fix the FID-in-dirent. So the up layer namespace LFSCK will
   get the wrong FID (not the original FID-in-dirent). Under such
   case, the up layer LFSCK will fix it as unmatched pairs, then
   the orphan cannot be recovered.

In fact, when injecting failure stub for LFSCK sanity test, we
hit similar issues as the 2) case. To resolve such trouble, we
can enhance the osd_dirent_check_repair() logic as following:
If the FID-in-dirent does not match the inode's FID-in-LMA, then
check the inode's linkEA, if it recognizes the dirent entry (with
parent dir's FID + child name), then trouble the inode, and fix
the FID-in-dirent with the FID-in-LMA. Otherwise, the dirent may
be corrupted, as the LFSCK processing, the right orphan may be
found, then fix it later. The worst case is that the inconsistence
is detected but kept there, but it will make wrong fixing.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I3516a6ad9cc1766453612c440df7db02bc2f09a4
Reviewed-on: http://review.whamcloud.com/22310
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c