]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ext2fs: fix fast symlink blocks check
authorAndreas Dilger <adilger@dilger.ca>
Fri, 8 Aug 2025 08:04:27 +0000 (02:04 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 11 Nov 2025 19:37:16 +0000 (14:37 -0500)
Use ext4_inode_is_fast_symlink() in ext2fs_inode_has_valid_blocks2()
instead of depending exclusively on i_blocks == 0 to determine
if an inode is a fast symlink. Otherwise, if a fast symlink has a
large external xattr inode that increases i_blocks, it will be
incorrectly reported as having invalid blocks.

Change-Id: Ibde2348da39401601abedd603bd7e4ef97091abe
Fixes: 0684a4f33 ("Overhaul extended attribute handling")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/59871
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-19121
Message-ID: <20250808080505.1307694-1-adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/valid_blk.c
tests/f_ea_inode_fast_symlink/expect.1 [new file with mode: 0644]
tests/f_ea_inode_fast_symlink/expect.2 [new file with mode: 0644]
tests/f_ea_inode_fast_symlink/image.gz [new file with mode: 0644]
tests/f_ea_inode_fast_symlink/name [new file with mode: 0644]

index db5d90ae4076d035020af61ab927417d17811bf6..332e9c66a08b48034ac423919f6feed886d7ebb3 100644 (file)
@@ -43,6 +43,7 @@ int ext2fs_inode_has_valid_blocks2(ext2_filsys fs, struct ext2_inode *inode)
                        /* With no EA block, we can rely on i_blocks */
                        if (inode->i_blocks == 0)
                                return 0;
+                       return !ext2fs_is_fast_symlink(inode);
                } else {
                        /* With an EA block, life gets more tricky */
                        if (inode->i_size >= EXT2_N_BLOCKS*4)
diff --git a/tests/f_ea_inode_fast_symlink/expect.1 b/tests/f_ea_inode_fast_symlink/expect.1
new file mode 100644 (file)
index 0000000..b88456d
--- /dev/null
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 14/256 files (0.0% non-contiguous), 1147/8192 blocks
+Exit status is 0
diff --git a/tests/f_ea_inode_fast_symlink/expect.2 b/tests/f_ea_inode_fast_symlink/expect.2
new file mode 100644 (file)
index 0000000..b88456d
--- /dev/null
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 14/256 files (0.0% non-contiguous), 1147/8192 blocks
+Exit status is 0
diff --git a/tests/f_ea_inode_fast_symlink/image.gz b/tests/f_ea_inode_fast_symlink/image.gz
new file mode 100644 (file)
index 0000000..f3872b3
Binary files /dev/null and b/tests/f_ea_inode_fast_symlink/image.gz differ
diff --git a/tests/f_ea_inode_fast_symlink/name b/tests/f_ea_inode_fast_symlink/name
new file mode 100644 (file)
index 0000000..9eebede
--- /dev/null
@@ -0,0 +1 @@
+fast symlink with ea_inode