ext2fs: fix fast symlink blocks check
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.
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
@@ -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
@@ -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
@@ -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
tests/f_ea_inode_fast_symlink/name new file +1 -0
@@ -0,0 +1 @@ +fast symlink with ea_inode
Signature · 1 line
2.43.5
Theodore Ts'o
AppliedQuoted 8 lines · Andreas Dilger
Use
ext4_inode_is_fast_symlink()inext2fs_inode_has_valid_blocks2()instead of depending exclusively oni_blocks== 0 to determine if an inode is a fast symlink. Otherwise, if a fast symlink has a large external xattr inode that increasesi_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]>