diff options
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/ioctl.c | 6 | ||||
-rw-r--r-- | fs/ext2/super.c | 24 | ||||
-rw-r--r-- | fs/ext2/xattr.c | 5 |
3 files changed, 21 insertions, 14 deletions
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 1dfba77eab10..e3cf8c81507f 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -44,6 +44,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
44 | if (!S_ISDIR(inode->i_mode)) | 44 | if (!S_ISDIR(inode->i_mode)) |
45 | flags &= ~EXT2_DIRSYNC_FL; | 45 | flags &= ~EXT2_DIRSYNC_FL; |
46 | 46 | ||
47 | mutex_lock(&inode->i_mutex); | ||
47 | oldflags = ei->i_flags; | 48 | oldflags = ei->i_flags; |
48 | 49 | ||
49 | /* | 50 | /* |
@@ -53,13 +54,16 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
53 | * This test looks nicer. Thanks to Pauline Middelink | 54 | * This test looks nicer. Thanks to Pauline Middelink |
54 | */ | 55 | */ |
55 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { | 56 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { |
56 | if (!capable(CAP_LINUX_IMMUTABLE)) | 57 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
58 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | 59 | return -EPERM; |
60 | } | ||
58 | } | 61 | } |
59 | 62 | ||
60 | flags = flags & EXT2_FL_USER_MODIFIABLE; | 63 | flags = flags & EXT2_FL_USER_MODIFIABLE; |
61 | flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; | 64 | flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; |
62 | ei->i_flags = flags; | 65 | ei->i_flags = flags; |
66 | mutex_unlock(&inode->i_mutex); | ||
63 | 67 | ||
64 | ext2_set_inode_flags(inode); | 68 | ext2_set_inode_flags(inode); |
65 | inode->i_ctime = CURRENT_TIME_SEC; | 69 | inode->i_ctime = CURRENT_TIME_SEC; |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index d8b9abd95d07..255cef5f7420 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -135,12 +135,12 @@ static void ext2_put_super (struct super_block * sb) | |||
135 | return; | 135 | return; |
136 | } | 136 | } |
137 | 137 | ||
138 | static kmem_cache_t * ext2_inode_cachep; | 138 | static struct kmem_cache * ext2_inode_cachep; |
139 | 139 | ||
140 | static struct inode *ext2_alloc_inode(struct super_block *sb) | 140 | static struct inode *ext2_alloc_inode(struct super_block *sb) |
141 | { | 141 | { |
142 | struct ext2_inode_info *ei; | 142 | struct ext2_inode_info *ei; |
143 | ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, SLAB_KERNEL); | 143 | ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL); |
144 | if (!ei) | 144 | if (!ei) |
145 | return NULL; | 145 | return NULL; |
146 | #ifdef CONFIG_EXT2_FS_POSIX_ACL | 146 | #ifdef CONFIG_EXT2_FS_POSIX_ACL |
@@ -156,7 +156,7 @@ static void ext2_destroy_inode(struct inode *inode) | |||
156 | kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); | 156 | kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); |
157 | } | 157 | } |
158 | 158 | ||
159 | static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) | 159 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) |
160 | { | 160 | { |
161 | struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; | 161 | struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; |
162 | 162 | ||
@@ -1090,8 +1090,10 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
1090 | { | 1090 | { |
1091 | struct super_block *sb = dentry->d_sb; | 1091 | struct super_block *sb = dentry->d_sb; |
1092 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 1092 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
1093 | struct ext2_super_block *es = sbi->s_es; | ||
1093 | unsigned long overhead; | 1094 | unsigned long overhead; |
1094 | int i; | 1095 | int i; |
1096 | u64 fsid; | ||
1095 | 1097 | ||
1096 | if (test_opt (sb, MINIX_DF)) | 1098 | if (test_opt (sb, MINIX_DF)) |
1097 | overhead = 0; | 1099 | overhead = 0; |
@@ -1104,7 +1106,7 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
1104 | * All of the blocks before first_data_block are | 1106 | * All of the blocks before first_data_block are |
1105 | * overhead | 1107 | * overhead |
1106 | */ | 1108 | */ |
1107 | overhead = le32_to_cpu(sbi->s_es->s_first_data_block); | 1109 | overhead = le32_to_cpu(es->s_first_data_block); |
1108 | 1110 | ||
1109 | /* | 1111 | /* |
1110 | * Add the overhead attributed to the superblock and | 1112 | * Add the overhead attributed to the superblock and |
@@ -1125,14 +1127,18 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
1125 | 1127 | ||
1126 | buf->f_type = EXT2_SUPER_MAGIC; | 1128 | buf->f_type = EXT2_SUPER_MAGIC; |
1127 | buf->f_bsize = sb->s_blocksize; | 1129 | buf->f_bsize = sb->s_blocksize; |
1128 | buf->f_blocks = le32_to_cpu(sbi->s_es->s_blocks_count) - overhead; | 1130 | buf->f_blocks = le32_to_cpu(es->s_blocks_count) - overhead; |
1129 | buf->f_bfree = ext2_count_free_blocks(sb); | 1131 | buf->f_bfree = ext2_count_free_blocks(sb); |
1130 | buf->f_bavail = buf->f_bfree - le32_to_cpu(sbi->s_es->s_r_blocks_count); | 1132 | buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count); |
1131 | if (buf->f_bfree < le32_to_cpu(sbi->s_es->s_r_blocks_count)) | 1133 | if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count)) |
1132 | buf->f_bavail = 0; | 1134 | buf->f_bavail = 0; |
1133 | buf->f_files = le32_to_cpu(sbi->s_es->s_inodes_count); | 1135 | buf->f_files = le32_to_cpu(es->s_inodes_count); |
1134 | buf->f_ffree = ext2_count_free_inodes (sb); | 1136 | buf->f_ffree = ext2_count_free_inodes(sb); |
1135 | buf->f_namelen = EXT2_NAME_LEN; | 1137 | buf->f_namelen = EXT2_NAME_LEN; |
1138 | fsid = le64_to_cpup((void *)es->s_uuid) ^ | ||
1139 | le64_to_cpup((void *)es->s_uuid + sizeof(u64)); | ||
1140 | buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL; | ||
1141 | buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL; | ||
1136 | return 0; | 1142 | return 0; |
1137 | } | 1143 | } |
1138 | 1144 | ||
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index af52a7f8b291..247efd0b51d6 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -342,12 +342,9 @@ static void ext2_xattr_update_super_block(struct super_block *sb) | |||
342 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR)) | 342 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR)) |
343 | return; | 343 | return; |
344 | 344 | ||
345 | lock_super(sb); | 345 | EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR); |
346 | EXT2_SB(sb)->s_es->s_feature_compat |= | ||
347 | cpu_to_le32(EXT2_FEATURE_COMPAT_EXT_ATTR); | ||
348 | sb->s_dirt = 1; | 346 | sb->s_dirt = 1; |
349 | mark_buffer_dirty(EXT2_SB(sb)->s_sbh); | 347 | mark_buffer_dirty(EXT2_SB(sb)->s_sbh); |
350 | unlock_super(sb); | ||
351 | } | 348 | } |
352 | 349 | ||
353 | /* | 350 | /* |