Skip to content

Commit fc82228

Browse files
Andi Kleentytso
authored andcommitted
ext4: support fast symlinks from ext3 file systems
407cd7f (ext4: change fast symlink test to not rely on i_blocks) broke ~10 years old ext3 file systems created by 2.6.17. Any ELF executable fails because the /lib/ld-linux.so.2 fast symlink cannot be read anymore. The patch assumed fast symlinks were created in a specific way, but that's not true on these really old file systems. The new behavior is apparently needed only with the large EA inode feature. Revert to the old behavior if the large EA inode feature is not set. This makes my old VM boot again. Fixes: 407cd7f (ext4: change fast symlink test to not rely on i_blocks) Signed-off-by: Andi Kleen <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Cc: [email protected]
1 parent ae64f9b commit fc82228

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/ext4/inode.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
149149
*/
150150
int ext4_inode_is_fast_symlink(struct inode *inode)
151151
{
152+
if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
153+
int ea_blocks = EXT4_I(inode)->i_file_acl ?
154+
EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
155+
156+
if (ext4_has_inline_data(inode))
157+
return 0;
158+
159+
return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0);
160+
}
152161
return S_ISLNK(inode->i_mode) && inode->i_size &&
153162
(inode->i_size < EXT4_N_BLOCKS * 4);
154163
}

0 commit comments

Comments
 (0)