diff options
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r-- | fs/ext4/ioctl.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index bb415408fdb6..7050a9cd04a4 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/capability.h> | 12 | #include <linux/capability.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/compat.h> | 14 | #include <linux/compat.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/mount.h> | 15 | #include <linux/mount.h> |
17 | #include <linux/file.h> | 16 | #include <linux/file.h> |
18 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
@@ -192,7 +191,7 @@ setversion_out: | |||
192 | case EXT4_IOC_GROUP_EXTEND: { | 191 | case EXT4_IOC_GROUP_EXTEND: { |
193 | ext4_fsblk_t n_blocks_count; | 192 | ext4_fsblk_t n_blocks_count; |
194 | struct super_block *sb = inode->i_sb; | 193 | struct super_block *sb = inode->i_sb; |
195 | int err, err2; | 194 | int err, err2=0; |
196 | 195 | ||
197 | if (!capable(CAP_SYS_RESOURCE)) | 196 | if (!capable(CAP_SYS_RESOURCE)) |
198 | return -EPERM; | 197 | return -EPERM; |
@@ -205,9 +204,11 @@ setversion_out: | |||
205 | return err; | 204 | return err; |
206 | 205 | ||
207 | err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); | 206 | err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); |
208 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); | 207 | if (EXT4_SB(sb)->s_journal) { |
209 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); | 208 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); |
210 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | 209 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); |
210 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
211 | } | ||
211 | if (err == 0) | 212 | if (err == 0) |
212 | err = err2; | 213 | err = err2; |
213 | mnt_drop_write(filp->f_path.mnt); | 214 | mnt_drop_write(filp->f_path.mnt); |
@@ -252,7 +253,7 @@ setversion_out: | |||
252 | case EXT4_IOC_GROUP_ADD: { | 253 | case EXT4_IOC_GROUP_ADD: { |
253 | struct ext4_new_group_data input; | 254 | struct ext4_new_group_data input; |
254 | struct super_block *sb = inode->i_sb; | 255 | struct super_block *sb = inode->i_sb; |
255 | int err, err2; | 256 | int err, err2=0; |
256 | 257 | ||
257 | if (!capable(CAP_SYS_RESOURCE)) | 258 | if (!capable(CAP_SYS_RESOURCE)) |
258 | return -EPERM; | 259 | return -EPERM; |
@@ -266,9 +267,11 @@ setversion_out: | |||
266 | return err; | 267 | return err; |
267 | 268 | ||
268 | err = ext4_group_add(sb, &input); | 269 | err = ext4_group_add(sb, &input); |
269 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); | 270 | if (EXT4_SB(sb)->s_journal) { |
270 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); | 271 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); |
271 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | 272 | err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); |
273 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
274 | } | ||
272 | if (err == 0) | 275 | if (err == 0) |
273 | err = err2; | 276 | err = err2; |
274 | mnt_drop_write(filp->f_path.mnt); | 277 | mnt_drop_write(filp->f_path.mnt); |