diff options
author | David Sterba <dsterba@suse.cz> | 2013-12-06 11:51:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-20 10:45:10 -0500 |
commit | 89ec75229a591cd7a3f57c330dc0791b8646b112 (patch) | |
tree | 0074b91e06f2f95ca4f1763e86a3ce8ceafd37a7 /fs | |
parent | 6b047827d4cdd57ac7c4f9da2d779d811649566f (diff) |
btrfs: call mnt_drop_write after interrupted subvol deletion
commit e43f998e47bae27e37e159915625e8d4b130153b 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: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ioctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 8dedf4019672..145b2c75ab83 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2093,7 +2093,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2093 | 2093 | ||
2094 | err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); | 2094 | err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); |
2095 | if (err == -EINTR) | 2095 | if (err == -EINTR) |
2096 | goto out; | 2096 | goto out_drop_write; |
2097 | dentry = lookup_one_len(vol_args->name, parent, namelen); | 2097 | dentry = lookup_one_len(vol_args->name, parent, namelen); |
2098 | if (IS_ERR(dentry)) { | 2098 | if (IS_ERR(dentry)) { |
2099 | err = PTR_ERR(dentry); | 2099 | err = PTR_ERR(dentry); |
@@ -2235,6 +2235,7 @@ out_dput: | |||
2235 | dput(dentry); | 2235 | dput(dentry); |
2236 | out_unlock_dir: | 2236 | out_unlock_dir: |
2237 | mutex_unlock(&dir->i_mutex); | 2237 | mutex_unlock(&dir->i_mutex); |
2238 | out_drop_write: | ||
2238 | mnt_drop_write_file(file); | 2239 | mnt_drop_write_file(file); |
2239 | out: | 2240 | out: |
2240 | kfree(vol_args); | 2241 | kfree(vol_args); |