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)
commit26870c3f5b15187268bf183055c7b9f29fe66079
tree04540c702a6bbcdb7554df763225ae9c9a2f3d67
parent1b929c02afd37871d5afb9d498426f83432e71c2
xfs: don't assert if cmap covers imap after cycling lock

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