]> git.hungrycats.org Git - linux/commit
btrfs: unlock i_mutex after attempting to delete subvolume during send
authorOmar Sandoval <osandov@osandov.com>
Fri, 10 Apr 2015 21:20:40 +0000 (14:20 -0700)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Thu, 23 Apr 2015 02:30:31 +0000 (22:30 -0400)
commit5996c23a1a0cd12c21784ae2b71221cd43f41d17
tree20f835ef1bf0503db8118060891e361be9ee08ed
parentd556ec11c266565934361be08292136eb09c7585
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>
(cherry picked from commit f5b5132ae00b3d62c31532064c0995ad02d92787)
fs/btrfs/ioctl.c