xfs: clean up the error handling in xfs_swap_extents
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 4 May 2020 21:06:27 +0000 (14:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:05:15 +0000 (09:05 +0200)
[ Upstream commit 8bc3b5e4b70d28f8edcafc3c9e4de515998eea9e ]

Make sure we release resources properly if we cannot clean out the COW
extents in preparation for an extent swap.

Fixes: 96987eea537d6c ("xfs: cancel COW blocks before swapext")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_bmap_util.c

index e638740f16813ba069971755ab97f96849bb8db0..3e1dd66bd6769b76d17fd1c8b7ad8da75c1b1c00 100644 (file)
@@ -1823,7 +1823,7 @@ xfs_swap_extents(
        if (xfs_inode_has_cow_data(tip)) {
                error = xfs_reflink_cancel_cow_range(tip, 0, NULLFILEOFF, true);
                if (error)
-                       return error;
+                       goto out_unlock;
        }
 
        /*