xfs: don't assert if cmap covers imap after cycling lock
authorDarrick J. Wong <djwong@kernel.org>
Mon, 26 Dec 2022 18:11:17 +0000 (10:11 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 26 Dec 2022 18:11:17 +0000 (10:11 -0800)
In xfs_reflink_fill_cow_hole, there's a debugging assertion that trips
if (after cycling the ILOCK to get a transaction) the requeried cow
mapping overlaps the start of the area being written.  IOWs, it trips if
the hole in the cow fork that it's supposed to fill has been filled.

This is trivially possible since we cycled ILOCK_EXCL.  If we trip the
assertion, then we know that cmap is a delalloc extent because @found is
false.  Fortunately, the bmapi_write call below will convert the
delalloc extent to a real unwritten cow fork extent, so all we need to
do here is remove the assertion.

It turns out that generic/095 trips this pretty regularly with alwayscow
mode enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_reflink.c

index fe46bce8cae6382442244183a29c5ec506fe35c4..5535778a98f925d0ce158cc64f09c3981fe3670e 100644 (file)
@@ -416,8 +416,6 @@ xfs_reflink_fill_cow_hole(
                goto convert;
        }
 
-       ASSERT(cmap->br_startoff > imap->br_startoff);
-
        /* Allocate the entire reservation as unwritten blocks. */
        nimaps = 1;
        error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,