btrfs: don't double unlock on error in btrfs_punch_hole
PATCH 1/1 btrfs: don't double unlock on error in btrfs_punch_hole
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.
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -2554,10 +2554,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) {
Signature · 1 line
2.13.5
Quoted 7 lines · Josef Bacik
If we have an error writing out a delalloc range in
btrfs_punch_hole_lock_rangewe'll unlock the inode and then gotoout_only_mutex, where we will again unlock the inode. This is bad, don't do this.Signed-off-by Josef Bacik <[email protected]>
Looks good, I introduced the double unlock accidentally.
Quoted 23 lines
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/btrfs/file.c +1
-4@@ -2554,10 +2554,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) { --2.13.5
Signature · 3 lines
Filipe David Manana, “Whether you think you can, or you think you can't — you're right.”
Quoted 7 lines · Filipe Manana
Quoted 5 lines · Josef Bacik
If we have an error writing out a delalloc range in
btrfs_punch_hole_lock_rangewe'll unlock the inode and then gotoout_only_mutex, where we will again unlock the inode. This is bad, don't do this.
Quoted 5 lines
Quoted 1 line
Signed-off-by Josef Bacik <[email protected]>Reviewed-by Filipe Manana <[email protected]>Looks good, I introduced the double unlock accidentally.
Does the patch need a Fixes: tag so the -stable
people know how far to backport it?
Quoted 8 lines · Rik van Riel
Quoted 7 lines · Filipe Manana
Quoted 5 lines · Josef Bacik
If we have an error writing out a delalloc range in
btrfs_punch_hole_lock_rangewe'll unlock the inode and then gotoout_only_mutex, where we will again unlock the inode. This is bad, don't do this.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Josef Bacik <[email protected]>Reviewed-by Filipe Manana <[email protected]>Looks good, I introduced the double unlock accidentally.
Does the patch need a Fixes: tag so the -stable
people know how far to backport it?
I add the tags.
Quoted 6 lines · Josef Bacik
If we have an error writing out a delalloc range in
btrfs_punch_hole_lock_rangewe'll unlock the inode and then gotoout_only_mutex, where we will again unlock the inode. This is bad, don't do this.Signed-off-by Josef Bacik <[email protected]>
Added to misc-next, thanks.