From: Andreas Dilger Date: Thu, 15 Apr 2021 02:41:43 +0000 (-0600) Subject: LU-14600 e2fsck: check trusted.link after linking inode X-Git-Tag: v1.45.6.wc7~2 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=87164b11;p=tools%2Fe2fsprogs.git 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 Change-Id: I447c1ce32f965311bfed1c08381928737dd9b02c Reviewed-on: https://review.whamcloud.com/43324 Tested-by: jenkins Reviewed-by: Li Dongyang --- diff --git a/e2fsck/pass4.c b/e2fsck/pass4.c index 03e1304..f048fff 100644 --- a/e2fsck/pass4.c +++ b/e2fsck/pass4.c @@ -287,7 +287,6 @@ void e2fsck_pass4(e2fsck_t ctx) * necessary. */ check_ea_inode(ctx, i, &last_ino, inode, &link_counted); - check_link_ea(ctx, i, &last_ino, inode, &link_counted); } if (link_counted == 0) { @@ -302,6 +301,7 @@ void e2fsck_pass4(e2fsck_t ctx) &link_count); ext2fs_icount_fetch(ctx->inode_count, i, &link_counted); + check_link_ea(ctx, i, &last_ino, inode, &link_counted); } isdir = ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i); if (isdir && (link_counted > EXT2_LINK_MAX)) {