Commit 014a1770 authored by Djalal Harouni's avatar Djalal Harouni Committed by Theodore Ts'o

ext4: add missing ext4_resize_end on error paths

Online resize ioctls 'EXT4_IOC_GROUP_EXTEND' and 'EXT4_IOC_GROUP_ADD'
call ext4_resize_begin() to check permissions and to set the
EXT4_RESIZING bit lock, they do their work and they must finish with
ext4_resize_end() which calls clear_bit_unlock() to unlock and to
avoid -EBUSY errors for the next resize operations.

This patch adds the missing ext4_resize_end() calls on error paths.

Patch tested.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarDjalal Harouni <tixxdz@opendz.org>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 61f296cc
...@@ -184,19 +184,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -184,19 +184,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (err) if (err)
return err; return err;
if (get_user(n_blocks_count, (__u32 __user *)arg)) if (get_user(n_blocks_count, (__u32 __user *)arg)) {
return -EFAULT; err = -EFAULT;
goto group_extend_out;
}
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
ext4_msg(sb, KERN_ERR, ext4_msg(sb, KERN_ERR,
"Online resizing not supported with bigalloc"); "Online resizing not supported with bigalloc");
return -EOPNOTSUPP; err = -EOPNOTSUPP;
goto group_extend_out;
} }
err = mnt_want_write(filp->f_path.mnt); err = mnt_want_write(filp->f_path.mnt);
if (err) if (err)
return err; goto group_extend_out;
err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count); err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count);
if (EXT4_SB(sb)->s_journal) { if (EXT4_SB(sb)->s_journal) {
...@@ -206,9 +209,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -206,9 +209,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
if (err == 0) if (err == 0)
err = err2; err = err2;
mnt_drop_write(filp->f_path.mnt); mnt_drop_write(filp->f_path.mnt);
group_extend_out:
ext4_resize_end(sb); ext4_resize_end(sb);
return err; return err;
} }
...@@ -267,19 +271,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -267,19 +271,22 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return err; return err;
if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg, if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg,
sizeof(input))) sizeof(input))) {
return -EFAULT; err = -EFAULT;
goto group_add_out;
}
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
ext4_msg(sb, KERN_ERR, ext4_msg(sb, KERN_ERR,
"Online resizing not supported with bigalloc"); "Online resizing not supported with bigalloc");
return -EOPNOTSUPP; err = -EOPNOTSUPP;
goto group_add_out;
} }
err = mnt_want_write(filp->f_path.mnt); err = mnt_want_write(filp->f_path.mnt);
if (err) if (err)
return err; goto group_add_out;
err = ext4_group_add(sb, &input); err = ext4_group_add(sb, &input);
if (EXT4_SB(sb)->s_journal) { if (EXT4_SB(sb)->s_journal) {
...@@ -289,9 +296,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -289,9 +296,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
if (err == 0) if (err == 0)
err = err2; err = err2;
mnt_drop_write(filp->f_path.mnt); mnt_drop_write(filp->f_path.mnt);
group_add_out:
ext4_resize_end(sb); ext4_resize_end(sb);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment