summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2019-05-03 18:10:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 16:46:02 +0300
commitce21e6586eece6502da23a9c275a60f2fdf8b8b8 (patch)
tree1761b78dc80586cd54d07f1749e213aae260e1f3 /fs/btrfs
parentfdc78eedc54d3d4eb0c3cd747226e5e9948fa860 (diff)
downloadlinux-ce21e6586eece6502da23a9c275a60f2fdf8b8b8.tar.xz
btrfs: don't double unlock on error in btrfs_punch_hole
commit 8fca955057b9c58467d1b231e43f19c4cf26ae8c upstream. If we have an error writing out a delalloc range in btrfs_punch_hole_lock_range we'll unlock the inode and then goto out_only_mutex, where we will again unlock the inode. This is bad, don't do this. Fixes: f27451f22996 ("Btrfs: add support for fallocate's zero range operation") CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/file.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index ca4902c66dc4..ed67aa91914c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2565,10 +2565,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend,
&cached_state);
- if (ret) {
- inode_unlock(inode);
+ if (ret)
goto out_only_mutex;
- }
path = btrfs_alloc_path();
if (!path) {