diff mbox series

[1/4] xfs: don't assert if cmap covers imap after cycling lock

Message ID 167149470312.336919.14005739948269903315.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series xfs: random fixes for 6.2, part 3 | expand

Commit Message

Darrick J. Wong Dec. 20, 2022, 12:05 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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>
---
 fs/xfs/xfs_reflink.c |    2 --
 1 file changed, 2 deletions(-)

Comments

Dave Chinner Dec. 20, 2022, 4:49 a.m. UTC | #1
On Mon, Dec 19, 2022 at 04:05:03PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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>
> ---
>  fs/xfs/xfs_reflink.c |    2 --
>  1 file changed, 2 deletions(-)

Looks fine.


Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index fe46bce8cae6..5535778a98f9 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -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,