aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-02-25 16:38:03 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-02-25 16:38:03 -0500
commit42bf0383d1e09dd1b38f3debb13a76b2f87634b3 (patch)
tree6806cafbbc0f72f84c16c4875909307c5aec09bf /fs/ext4
parent2c98615d3b64ce7888cd46cc668023f456daf287 (diff)
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ialloc.c22
-rw-r--r--fs/ext4/namei.c1
2 files changed, 15 insertions, 8 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index da18a74b966a..8036b9b5376b 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -702,7 +702,12 @@ got:
702 ei->i_dir_start_lookup = 0; 702 ei->i_dir_start_lookup = 0;
703 ei->i_disksize = 0; 703 ei->i_disksize = 0;
704 704
705 ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL; 705 /*
706 * Don't inherit extent flag from directory. We set extent flag on
707 * newly created directory and file only if -o extent mount option is
708 * specified
709 */
710 ei->i_flags = EXT4_I(dir)->i_flags & ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL);
706 if (S_ISLNK(mode)) 711 if (S_ISLNK(mode))
707 ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL); 712 ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
708 /* dirsync only applies to directories */ 713 /* dirsync only applies to directories */
@@ -745,12 +750,15 @@ got:
745 goto fail_free_drop; 750 goto fail_free_drop;
746 } 751 }
747 if (test_opt(sb, EXTENTS)) { 752 if (test_opt(sb, EXTENTS)) {
748 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; 753 /* set extent flag only for directory and file */
749 ext4_ext_tree_init(handle, inode); 754 if (S_ISDIR(mode) || S_ISREG(mode)) {
750 err = ext4_update_incompat_feature(handle, sb, 755 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
751 EXT4_FEATURE_INCOMPAT_EXTENTS); 756 ext4_ext_tree_init(handle, inode);
752 if (err) 757 err = ext4_update_incompat_feature(handle, sb,
753 goto fail; 758 EXT4_FEATURE_INCOMPAT_EXTENTS);
759 if (err)
760 goto fail;
761 }
754 } 762 }
755 763
756 ext4_debug("allocating inode %lu\n", inode->i_ino); 764 ext4_debug("allocating inode %lu\n", inode->i_ino);
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 5a79c6b6dc69..28aa2ed4297e 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2220,7 +2220,6 @@ retry:
2220 inode->i_op = &ext4_fast_symlink_inode_operations; 2220 inode->i_op = &ext4_fast_symlink_inode_operations;
2221 memcpy((char*)&EXT4_I(inode)->i_data,symname,l); 2221 memcpy((char*)&EXT4_I(inode)->i_data,symname,l);
2222 inode->i_size = l-1; 2222 inode->i_size = l-1;
2223 EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL;
2224 } 2223 }
2225 EXT4_I(inode)->i_disksize = inode->i_size; 2224 EXT4_I(inode)->i_disksize = inode->i_size;
2226 err = ext4_add_nondir(handle, dentry, inode); 2225 err = ext4_add_nondir(handle, dentry, inode);