Commit b8356c46 authored by Valerie Clement's avatar Valerie Clement Committed by Theodore Ts'o

ext4: Don't set EXTENTS_FL flag for fast symlinks

For fast symbolic links, the file content is stored in the i_block[]
array, which is not compatible with the new file extents format.
e2fsck reports error on such files because EXTENTS_FL is set.
Don't set the EXTENTS_FL flag when creating fast symlinks.

In the case of file migration, skip fast symbolic links.
Signed-off-by: default avatarValerie Clement <valerie.clement@bull.net>
Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 4d605179
...@@ -414,6 +414,12 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp, ...@@ -414,6 +414,12 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp,
if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
return -EINVAL; return -EINVAL;
if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
/*
* don't migrate fast symlink
*/
return retval;
down_write(&EXT4_I(inode)->i_data_sem); down_write(&EXT4_I(inode)->i_data_sem);
handle = ext4_journal_start(inode, handle = ext4_journal_start(inode,
EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + EXT4_DATA_TRANS_BLOCKS(inode->i_sb) +
......
...@@ -2223,6 +2223,7 @@ retry: ...@@ -2223,6 +2223,7 @@ retry:
inode->i_op = &ext4_fast_symlink_inode_operations; inode->i_op = &ext4_fast_symlink_inode_operations;
memcpy((char*)&EXT4_I(inode)->i_data,symname,l); memcpy((char*)&EXT4_I(inode)->i_data,symname,l);
inode->i_size = l-1; inode->i_size = l-1;
EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL;
} }
EXT4_I(inode)->i_disksize = inode->i_size; EXT4_I(inode)->i_disksize = inode->i_size;
err = ext4_add_nondir(handle, dentry, inode); err = ext4_add_nondir(handle, dentry, inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment