mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrea Parri <parri.andrea@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>,
	Carlos Maiolino <cem@kernel.org>,
	Joanne Koong <joannelkoong@gmail.com>,
	Brian Foster <bfoster@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	Hannes Reinecke <hare@suse.de>,
	Daniel Gomez <da.gomez@samsung.com>,
	Pankaj Raghav <p.raghav@samsung.com>,
	Dave Chinner <dchinner@redhat.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] xfs: add an error tag to inject a ->writeback_submit() failure
Date: Thu, 24 Sep 2026 11:49:59 -0700	[thread overview]
Message-ID: <20260924184959.GJ2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <20260924091203.198225-3-parri.andrea@gmail.com>

On Thu, Sep 24, 2026 at 11:11:52AM +0200, Andrea Parri wrote:
> The only in-tree way for xfs_writeback_submit() to fail is a failing
> xfs_reflink_convert_cow(), which requires a shared (reflinked) CoW
> extent.  There was previously no way to exercise that failure path
> from userspace, which made it hard to write an xfstest for it, e.g.
> for "iomap: don't resubmit an ioend after ->writeback_submit()
> failed".
> 
> Add XFS_ERRTAG_WB_COW_CONVERT_ERROR to force xfs_reflink_convert_cow()
> to fail with -EIO, so that ->writeback_submit() failure and its
> callers' error handling can be exercised with error injection alone,
> without needing a corrupted or racy COW fork.
> 
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Assisted-by: LLM
> Signed-off-by: Andrea Parri <parri.andrea@gmail.com>

Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_errortag.h | 6 ++++--
>  fs/xfs/xfs_reflink.c         | 5 +++++
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h
> index 6de207fed2d89..e6b0864051b0a 100644
> --- a/fs/xfs/libxfs/xfs_errortag.h
> +++ b/fs/xfs/libxfs/xfs_errortag.h
> @@ -75,7 +75,8 @@
>  #define XFS_ERRTAG_METAFILE_RESV_CRITICAL		45
>  #define XFS_ERRTAG_FORCE_ZERO_RANGE			46
>  #define XFS_ERRTAG_ZONE_RESET				47
> -#define XFS_ERRTAG_MAX					48
> +#define XFS_ERRTAG_WB_COW_CONVERT_ERROR		48
> +#define XFS_ERRTAG_MAX					49
>  
>  /*
>   * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
> @@ -137,7 +138,8 @@ XFS_ERRTAG(WRITE_DELAY_MS,	write_delay_ms,		3000) \
>  XFS_ERRTAG(EXCHMAPS_FINISH_ONE,	exchmaps_finish_one,	1) \
>  XFS_ERRTAG(METAFILE_RESV_CRITICAL, metafile_resv_crit,	4) \
>  XFS_ERRTAG(FORCE_ZERO_RANGE,	force_zero_range,	4) \
> -XFS_ERRTAG(ZONE_RESET,		zone_reset,		1)
> +XFS_ERRTAG(ZONE_RESET,		zone_reset,		1) \
> +XFS_ERRTAG(WB_COW_CONVERT_ERROR, wb_cow_convert_error,	1)
>  #endif /* XFS_ERRTAG */
>  
>  #endif /* __XFS_ERRORTAG_H_ */
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 4801361366359..104542b10d9e0 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -34,6 +34,8 @@
>  #include "xfs_rtalloc.h"
>  #include "xfs_rtgroup.h"
>  #include "xfs_metafile.h"
> +#include "xfs_errortag.h"
> +#include "xfs_error.h"
>  
>  /*
>   * Copy on Write of Shared Blocks
> @@ -346,6 +348,9 @@ xfs_reflink_convert_cow(
>  
>  	ASSERT(count != 0);
>  
> +	if (XFS_TEST_ERROR(mp, XFS_ERRTAG_WB_COW_CONVERT_ERROR))
> +		return -EIO;
> +
>  	xfs_ilock(ip, XFS_ILOCK_EXCL);
>  	error = xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
>  	xfs_iunlock(ip, XFS_ILOCK_EXCL);
> -- 
> 2.53.0
> 
> 

  reply	other threads:[~2026-09-24 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  9:11 [PATCH v2 0/4] iomap: fix error handling regressions Andrea Parri
2026-09-24  9:11 ` [PATCH v2 1/4] iomap: don't resubmit an ioend after ->writeback_submit() failed Andrea Parri
2026-09-24 18:49   ` Darrick J. Wong
2026-09-24  9:11 ` [PATCH v2 2/4] xfs: add an error tag to inject a ->writeback_submit() failure Andrea Parri
2026-09-24 18:49   ` Darrick J. Wong [this message]
2026-09-24  9:11 ` [PATCH v2 3/4] iomap: don't lose a fiemap iteration error when emitting the last extent Andrea Parri
2026-09-24  9:11 ` [PATCH v2 4/4] iomap: don't lose a failed direct I/O bio's error when zeroing the tail Andrea Parri
2026-09-24 18:53   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260924184959.GJ2705364@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=da.gomez@samsung.com \
    --cc=dchinner@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=parri.andrea@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®