Skip to contentSkip to conversation

ext2fs: fix fast symlink blocks check

PATCH Applied Andreas Dilger 2 participants 2 messages Aug 8, 2025 – Nov 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ext2fs: fix fast symlink blocks check

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")

Reviewed-on: https://review.whamcloud.com/59871
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-19121
---
v1->v2: added f_ea_inode_fast_symlink test case

 lib/ext2fs/valid_blk.c                 |   1 +
 tests/f_ea_inode_fast_symlink/expect.1 |   7 +++++++
 tests/f_ea_inode_fast_symlink/expect.2 |   7 +++++++
 tests/f_ea_inode_fast_symlink/image.gz | Bin 0 -> 13789 bytes
 tests/f_ea_inode_fast_symlink/name     |   1 +
 5 files changed, 16 insertions(+)
 create mode 100644 tests/f_ea_inode_fast_symlink/expect.1
 create mode 100644 tests/f_ea_inode_fast_symlink/expect.2
 create mode 100644 tests/f_ea_inode_fast_symlink/image.gz
 create mode 100644 tests/f_ea_inode_fast_symlink/name
lib/ext2fs/valid_blk.c +1 -0
index db5d90ae4..332e9c66a 100644
@@ -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)
tests/f_ea_inode_fast_symlink/expect.1 new file +7 -0
new file mode 100644
index 000000000..b88456d00
@@ -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
tests/f_ea_inode_fast_symlink/expect.2 new file +7 -0
new file mode 100644
index 000000000..b88456d00
@@ -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
tests/f_ea_inode_fast_symlink/image.gz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..f3872b3721fa8484e05cc3281d0bc745113fa775
GIT binary patch
tests/f_ea_inode_fast_symlink/name new file +1 -0
new file mode 100644
index 000000000..9eebeded8
@@ -0,0 +1 @@
+fast symlink with ea_inode
Signature · 1 line
2.43.5
#1 lore raw
Quoted 8 lines · Andreas Dilger

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.

[...]

Applied, thanks!

[1/1] ext2fs: fix fast symlink blocks check

      commit: ae7370a5fa175c609bd7c780a5ffaefdd58efc91

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>