aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/ioctl.c')
-rw-r--r--fs/ext4/ioctl.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 24a6abb2aef5..7050a9cd04a4 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -191,7 +191,7 @@ setversion_out:
191 case EXT4_IOC_GROUP_EXTEND: { 191 case EXT4_IOC_GROUP_EXTEND: {
192 ext4_fsblk_t n_blocks_count; 192 ext4_fsblk_t n_blocks_count;
193 struct super_block *sb = inode->i_sb; 193 struct super_block *sb = inode->i_sb;
194 int err, err2; 194 int err, err2=0;
195 195
196 if (!capable(CAP_SYS_RESOURCE)) 196 if (!capable(CAP_SYS_RESOURCE))
197 return -EPERM; 197 return -EPERM;
@@ -204,9 +204,11 @@ setversion_out:
204 return err; 204 return err;
205 205
206 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);
207 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); 207 if (EXT4_SB(sb)->s_journal) {
208 err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); 208 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
209 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 }
210 if (err == 0) 212 if (err == 0)
211 err = err2; 213 err = err2;
212 mnt_drop_write(filp->f_path.mnt); 214 mnt_drop_write(filp->f_path.mnt);
@@ -251,7 +253,7 @@ setversion_out:
251 case EXT4_IOC_GROUP_ADD: { 253 case EXT4_IOC_GROUP_ADD: {
252 struct ext4_new_group_data input; 254 struct ext4_new_group_data input;
253 struct super_block *sb = inode->i_sb; 255 struct super_block *sb = inode->i_sb;
254 int err, err2; 256 int err, err2=0;
255 257
256 if (!capable(CAP_SYS_RESOURCE)) 258 if (!capable(CAP_SYS_RESOURCE))
257 return -EPERM; 259 return -EPERM;
@@ -265,9 +267,11 @@ setversion_out:
265 return err; 267 return err;
266 268
267 err = ext4_group_add(sb, &input); 269 err = ext4_group_add(sb, &input);
268 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); 270 if (EXT4_SB(sb)->s_journal) {
269 err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal); 271 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
270 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 }
271 if (err == 0) 275 if (err == 0)
272 err = err2; 276 err = err2;
273 mnt_drop_write(filp->f_path.mnt); 277 mnt_drop_write(filp->f_path.mnt);