btrfs: call mnt_drop_write after interrupted subvol deletion
If btrfs_ioctl_snap_destroy blocks on the mutex and the process is killed, mnt_write count is unbalanced and leads to unmountable filesystem. CC: stable@vger.kernel.org Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
a7e252af5a
commit
e43f998e47
|
@ -2121,7 +2121,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
|
||||||
|
|
||||||
err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
|
err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
|
||||||
if (err == -EINTR)
|
if (err == -EINTR)
|
||||||
goto out;
|
goto out_drop_write;
|
||||||
dentry = lookup_one_len(vol_args->name, parent, namelen);
|
dentry = lookup_one_len(vol_args->name, parent, namelen);
|
||||||
if (IS_ERR(dentry)) {
|
if (IS_ERR(dentry)) {
|
||||||
err = PTR_ERR(dentry);
|
err = PTR_ERR(dentry);
|
||||||
|
@ -2284,6 +2284,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
out_unlock_dir:
|
out_unlock_dir:
|
||||||
mutex_unlock(&dir->i_mutex);
|
mutex_unlock(&dir->i_mutex);
|
||||||
|
out_drop_write:
|
||||||
mnt_drop_write_file(file);
|
mnt_drop_write_file(file);
|
||||||
out:
|
out:
|
||||||
kfree(vol_args);
|
kfree(vol_args);
|
||||||
|
|
Loading…
Reference in New Issue