Fix commit ID reference in the fast symlink patch.
[ext4-patch-queue.git] / support-fast-symlinks-from-ext3-file-systems
blob38b66009e3c750de5d12c772f054b9d8b226c8fe
1 ext4: support fast symlinks from ext3 file systems
3 From: Andi Kleen <ak@linux.intel.com>
5 407cd7fb83c0 (ext4: change fast symlink test to not rely on i_blocks)
6 broke ~10 years old ext3 file systems created by 2.6.17. Any ELF
7 executable fails because the /lib/ld-linux.so.2 fast symlink
8 cannot be read anymore.
10 The patch assumed fast symlinks were created in a specific way,
11 but that's not true on these really old file systems.
13 The new behavior is apparently needed only with the large EA inode
14 feature.
16 Revert to the old behavior if the large EA inode feature is not set.
18 This makes my old VM boot again.
20 Fixes: 407cd7fb83c0 (ext4: change fast symlink test to not rely on i_blocks)
21 Signed-off-by: Andi Kleen <ak@linux.intel.com>
22 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
23 Reviewed-by: Andreas Dilger <adilger@dilger.ca>
24 Cc: stable@vger.kernel.org
25 ---
26  fs/ext4/inode.c | 9 +++++++++
27  1 file changed, 9 insertions(+)
29 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
30 index 0992d76f7ab1..6b82b0ff5e0b 100644
31 --- a/fs/ext4/inode.c
32 +++ b/fs/ext4/inode.c
33 @@ -149,6 +149,15 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
34   */
35  int ext4_inode_is_fast_symlink(struct inode *inode)
36  {
37 +       if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
38 +               int ea_blocks = EXT4_I(inode)->i_file_acl ?
39 +                               EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
41 +               if (ext4_has_inline_data(inode))
42 +                       return 0;
44 +               return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0);
45 +       }
46         return S_ISLNK(inode->i_mode) && inode->i_size &&
47                (inode->i_size < EXT4_N_BLOCKS * 4);
48  }
49 -- 
50 2.13.6