]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfs: avoid infinite loop when cancelling CoW blocks after writeback failure
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 11 Dec 2017 02:03:55 +0000 (18:03 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 14 Dec 2017 17:20:11 +0000 (09:20 -0800)
When we're cancelling a cow range, we don't always delete each extent
that we iterate, so we have to move icur backwards in the list to avoid
an infinite loop.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_reflink.c

index 99c5852f9fe785b3bb2522f770f0345ec8d635e6..6931b0c79cac2518ed41160ff8386f1706987888 100644 (file)
@@ -611,6 +611,9 @@ xfs_reflink_cancel_cow_blocks(
 
                        /* Remove the mapping from the CoW fork. */
                        xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
+               } else {
+                       /* Didn't do anything, push cursor back. */
+                       xfs_iext_prev(ifp, &icur);
                }
 next_extent:
                if (!xfs_iext_get_extent(ifp, &icur, &got))