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)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 6 May 2020 20:17:21 +0000 (13:17 -0700)
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>
fs/xfs/xfs_bmap_util.c

index 4f800f7fe88829c7644fef379badc298971d775d..cc23a3e23e2d10a6ef217ceb77f94ba9edbea123 100644 (file)
@@ -1606,7 +1606,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;
        }
 
        /*