1From 3dcbf460613413614684013a51279f1e65c32f9e Mon Sep 17 00:00:00 2001 2From: zhanchengbin <zhanchengbin1@huawei.com> 3Date: Wed, 18 May 2022 15:16:25 +0800 4Subject: [PATCH] e2fsck: do not clean up file acl if the inode is truncating 5 type 6 7We got issue as follows: 8 [root@localhost ~]# e2fsck -a img 9 img: recovering journal 10 img: Truncating orphaned inode 188 (uid=0, gid=0, mode=0100666, size=0) 11 img: Truncating orphaned inode 174 (uid=0, gid=0, mode=0100666, size=0) 12 img: clean, 484/128016 files, 118274/512000 blocks 13 [root@localhost ~]# e2fsck -fn img 14 e2fsck 1.46.5 (30-Dec-2021) 15 Pass 1: Checking inodes, blocks, and sizes 16 Inode 174, i_blocks is 2, should be 0. Fix? no 17 18 Inode 188, i_blocks is 2, should be 0. Fix? no 19 20 Pass 2: Checking directory structure 21 Pass 3: Checking directory connectivity 22 Pass 4: Checking reference counts 23 Pass 5: Checking group summary information 24 25 img: ********** WARNING: Filesystem still has errors ********** 26 27 img: 484/128016 files (24.6% non-contiguous), 118274/512000 blocks 28 29File acl would be clean up in release_inode_blocks, whether the orphan 30node is truncating or clearing type. If the inode is truncating type, 31the file acl would be clean up, but the blocks count is not be 32subtract acl blocks, and the inode is not unmark in bitmap, which causes 33this issue. 34 35To slove this issue, do not clean up file acl if the inode is truncating 36type. 37 38Signed-off-by: LiJinlin <lijinlin3@huawei.com> 39Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> 40--- 41 e2fsck/super.c | 4 ++++ 42 1 file changed, 4 insertions(+) 43 44diff --git a/e2fsck/super.c b/e2fsck/super.c 45index 31e2ffb..ec28426 100644 46--- a/e2fsck/super.c 47+++ b/e2fsck/super.c 48@@ -235,6 +235,10 @@ static int release_inode_blocks(e2fsck_t ctx, ext2_ino_t ino, 49 if (pb.truncated_blocks) 50 ext2fs_iblk_sub_blocks(fs, EXT2_INODE(inode), 51 pb.truncated_blocks); 52+ 53+ /* do not clean up file acl if the inode is truncating type */ 54+ if (inode->i_links_count) 55+ return 0; 56 57 blk = ext2fs_file_acl_block(fs, EXT2_INODE(inode)); 58 if (blk) { 59-- 601.8.3.1 61 62