[PATCH 13/33] xfs: return -EAGAIN from xfs_reflink_allocate_cow for all allocation cases
Dave Chinner <[email protected]> Wed, 29 Jul 2026 20:01:57 +1000
| Newsgroups | org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <[email protected]> |
Consolidate the -EAGAIN transaction check for both COW hole and delalloc allocation paths. Both cases require a transaction to proceed, so lift the *tpp == NULL check above both branches and return -EAGAIN from a single point. This activates the retry loop for the delalloc case, which was previously handled by cycling the ILOCK internally in xfs_reflink_fill_delalloc(). Assisted-by: LLM Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/xfs_reflink.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 3e8eb16ce076..cc3c1caee2d8 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -616,23 +616,20 @@ xfs_reflink_allocate_cow( convert_now); /* - * CoW fork does not have an extent and data extent is shared. - * Allocate a real extent in the CoW fork. If the caller has not - * provided a transaction for the allocation, return -EAGAIN to - * tell the caller to allocate a transaction and retry. + * Allocation is now required, so we need a transaction context from + * the caller if it hasn't already supplied one. */ - if (cmap->br_startoff > imap->br_startoff) { - if (!*tpp) - return -EAGAIN; + if (!*tpp) + return -EAGAIN; + + if (cmap->br_startoff > imap->br_startoff) return xfs_reflink_fill_cow_hole(tpp, ip, imap, cmap, shared, convert_now); - } /* * CoW fork has a delalloc reservation. Replace it with a real extent. * There may or may not be a data fork mapping. */ - ASSERT(!*tpp); if (isnullstartblock(cmap->br_startblock) || cmap->br_startblock == DELAYSTARTBLOCK) return xfs_reflink_fill_delalloc(tpp, ip, imap, cmap, shared, -- 2.55.0