diff options
author | Omar Sandoval <osandov@osandov.com> | 2015-04-10 17:20:40 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-26 09:27:02 -0400 |
commit | 909e26dce3f7600f5e293ac0522c28790a0c8c9c (patch) | |
tree | 253080ceb1292bf9188d93b8bb6555aea725d27d /fs/btrfs | |
parent | b86054540e4ad7d8df67f3a80658d037a2ce1c02 (diff) |
btrfs: unlock i_mutex after attempting to delete subvolume during send
Whenever the check for a send in progress introduced in commit
521e0546c970 (btrfs: protect snapshots from deleting during send) is
hit, we return without unlocking inode->i_mutex. This is easy to see
with lockdep enabled:
[ +0.000059] ================================================
[ +0.000028] [ BUG: lock held when returning to user space! ]
[ +0.000029] 4.0.0-rc5-00096-g3c435c1 #93 Not tainted
[ +0.000026] ------------------------------------------------
[ +0.000029] btrfs/211 is leaving the kernel with locks still held!
[ +0.000029] 1 lock held by btrfs/211:
[ +0.000023] #0: (&type->i_mutex_dir_key){+.+.+.}, at: [<ffffffff8135b8df>] btrfs_ioctl_snap_destroy+0x2df/0x7a0
Make sure we unlock it in the error path.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-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 ca5d968f4c37..cdcd98ceddea 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2410,7 +2410,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2410 | "Attempt to delete subvolume %llu during send", | 2410 | "Attempt to delete subvolume %llu during send", |
2411 | dest->root_key.objectid); | 2411 | dest->root_key.objectid); |
2412 | err = -EPERM; | 2412 | err = -EPERM; |
2413 | goto out_dput; | 2413 | goto out_unlock_inode; |
2414 | } | 2414 | } |
2415 | 2415 | ||
2416 | d_invalidate(dentry); | 2416 | d_invalidate(dentry); |
@@ -2505,6 +2505,7 @@ out_up_write: | |||
2505 | root_flags & ~BTRFS_ROOT_SUBVOL_DEAD); | 2505 | root_flags & ~BTRFS_ROOT_SUBVOL_DEAD); |
2506 | spin_unlock(&dest->root_item_lock); | 2506 | spin_unlock(&dest->root_item_lock); |
2507 | } | 2507 | } |
2508 | out_unlock_inode: | ||
2508 | mutex_unlock(&inode->i_mutex); | 2509 | mutex_unlock(&inode->i_mutex); |
2509 | if (!err) { | 2510 | if (!err) { |
2510 | shrink_dcache_sb(root->fs_info->sb); | 2511 | shrink_dcache_sb(root->fs_info->sb); |