Whamcloud - gitweb
LU-11446 e2fsck: check trusted.link when fixing nlink 31/43231/2
authorLi Dongyang <dongyangli@ddn.com>
Tue, 30 Mar 2021 11:22:40 +0000 (22:22 +1100)
committerLi Dongyang <dongyangli@ddn.com>
Wed, 21 Apr 2021 09:34:24 +0000 (19:34 +1000)
commitb9cbd54b4a9c1bef0362b9b84b3ab61da0025998
tree03e37552436251c64bdb3d6bfe233f568130d009
parentad5d34f324b1c84857141761a48ea7f107c200e3
LU-11446 e2fsck: check trusted.link when fixing nlink

The inode link count could be higher than what is stored in the
local MDT inode because of remote file links from DNE MDTs.
If we find a mismatched link count, look up the "trusted.link"
xattr.  If it exists, do a sanity check on it, and use the
leh_reccount stored there if larger than the local link count.

If leh_overflow_time is set, then the "trusted.link" xattr may
not hold all of the links, so assume the maximum of available
link counts is valid until LFSCK clears leh_overflow_time.

  LU-14600 e2fsck: check trusted.link after linking inode

  If the inode is not linked into the namespace, link it into
  lost+found before checking the trusted.link xattr to get the
  DNE link count.

  Fixes: 6528bce00bea ("LU-11446 e2fsck: check trusted.link when fixing nlink")
  Test-Parameters: testlist=sanity-lfsck
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Change-Id: I447c1ce32f965311bfed1c08381928737dd9b02c
  Reviewed-on: https://review.whamcloud.com/43324
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
  LU-14600 e2fsck: trusted.link unref inode test case

  Update the f_trusted_link test case to include a locally
  unreferenced inode that has a trusted.link xattr.  The
  inode should be linked into lost+found because of the xattr,
  even if it has no blocks/data, and the link cound should be
  extracted from the trusted.link xattr.

  Change-Id: Ifad410d0bc1ceb140216dbed48e54ea3825abe3b
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
  Reviewed-on: https://review.whamcloud.com/43335
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: I213d816a92043c348eb55374aaa98e98957ccf23
Reviewed-on: https://review.whamcloud.com/43169
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
e2fsck/pass4.c
lib/ext2fs/ext2fs.h
lib/ext2fs/ext_attr.c
lib/ext2fs/lfsck.h
tests/f_trusted_link/expect.1 [new file with mode: 0644]
tests/f_trusted_link/expect.2 [new file with mode: 0644]
tests/f_trusted_link/image.gz [new file with mode: 0644]
tests/f_trusted_link/name [new file with mode: 0644]