mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
ext4: set EXT4_EXTENTS_FL only for directory and regular files
In addition, don't inherit EXT4_EXTENTS_FL from parent directory. If we have a directory with extent flag set and later mount the file system with -o noextents, the files created in that directory will also have extent flag set but we would not have called ext4_ext_tree_init for them. This will cause error later when we are verifying the extent header Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Acked-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
2c98615d3b
commit
42bf0383d1
2 changed files with 15 additions and 8 deletions
|
@ -702,7 +702,12 @@ got:
|
||||||
ei->i_dir_start_lookup = 0;
|
ei->i_dir_start_lookup = 0;
|
||||||
ei->i_disksize = 0;
|
ei->i_disksize = 0;
|
||||||
|
|
||||||
ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL;
|
/*
|
||||||
|
* Don't inherit extent flag from directory. We set extent flag on
|
||||||
|
* newly created directory and file only if -o extent mount option is
|
||||||
|
* specified
|
||||||
|
*/
|
||||||
|
ei->i_flags = EXT4_I(dir)->i_flags & ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL);
|
||||||
if (S_ISLNK(mode))
|
if (S_ISLNK(mode))
|
||||||
ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
|
ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
|
||||||
/* dirsync only applies to directories */
|
/* dirsync only applies to directories */
|
||||||
|
@ -745,12 +750,15 @@ got:
|
||||||
goto fail_free_drop;
|
goto fail_free_drop;
|
||||||
}
|
}
|
||||||
if (test_opt(sb, EXTENTS)) {
|
if (test_opt(sb, EXTENTS)) {
|
||||||
EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
|
/* set extent flag only for directory and file */
|
||||||
ext4_ext_tree_init(handle, inode);
|
if (S_ISDIR(mode) || S_ISREG(mode)) {
|
||||||
err = ext4_update_incompat_feature(handle, sb,
|
EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
|
||||||
EXT4_FEATURE_INCOMPAT_EXTENTS);
|
ext4_ext_tree_init(handle, inode);
|
||||||
if (err)
|
err = ext4_update_incompat_feature(handle, sb,
|
||||||
goto fail;
|
EXT4_FEATURE_INCOMPAT_EXTENTS);
|
||||||
|
if (err)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext4_debug("allocating inode %lu\n", inode->i_ino);
|
ext4_debug("allocating inode %lu\n", inode->i_ino);
|
||||||
|
|
|
@ -2220,7 +2220,6 @@ 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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue