Commit 89ec7522 authored by David Sterba's avatar David Sterba Committed by Greg Kroah-Hartman

btrfs: call mnt_drop_write after interrupted subvol deletion

commit e43f998e upstream.

If btrfs_ioctl_snap_destroy blocks on the mutex and the process is
killed, mnt_write count is unbalanced and leads to unmountable
filesystem.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6b047827
......@@ -2093,7 +2093,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT);
if (err == -EINTR)
goto out;
goto out_drop_write;
dentry = lookup_one_len(vol_args->name, parent, namelen);
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
......@@ -2235,6 +2235,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
dput(dentry);
out_unlock_dir:
mutex_unlock(&dir->i_mutex);
out_drop_write:
mnt_drop_write_file(file);
out:
kfree(vol_args);
......
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