xfs: add missing error check in xfs_prepare_shift()
authorBrian Foster <bfoster@redhat.com>
Fri, 26 Apr 2019 14:30:24 +0000 (07:30 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Apr 2019 19:28:56 +0000 (12:28 -0700)
xfs_prepare_shift() fails to check the error return from
xfs_flush_unmap_range(). If the latter fails, that could lead to an
insert/collapse range operation over a delalloc range, which is not
supported.

Add an error check and return appropriately. This is reproduced
rarely by generic/475.

Fixes: 7f9f71be84bc ("xfs: extent shifting doesn't fully invalidate page cache")
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_bmap_util.c

index 2db43ff4f8b59d303b70a0dbf537a45bbf897706..06d07f1e310b063db9b4ffd8d393f22d73d6115a 100644 (file)
@@ -1193,6 +1193,8 @@ xfs_prepare_shift(
         * about to shift down every extent from offset to EOF.
         */
        error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
+       if (error)
+               return error;
 
        /*
         * Clean out anything hanging around in the cow fork now that