Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>,
	linux-xfs@vger.kernel.org, Carlos Maiolino <cmaiolino@redhat.com>
Subject: Re: [PATCH 3/6] xfs: improve the xfs_buf_ioend_fail calling convention
Date: Thu, 25 Jun 2026 11:04:23 -0700	[thread overview]
Message-ID: <20260625180423.GH6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260625135849.2494779-4-hch@lst.de>

On Thu, Jun 25, 2026 at 03:58:33PM +0200, Christoph Hellwig wrote:
> Move setting the ASYNC flag into xfs_buf_ioend_fail, assert that the
> buffer is locked as expected, and drop the confusing _ioend in the
> name.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

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

--D

> ---
>  fs/xfs/xfs_buf.c      | 13 +++++++------
>  fs/xfs/xfs_buf.h      |  2 +-
>  fs/xfs/xfs_buf_item.c |  3 +--
>  fs/xfs/xfs_inode.c    |  3 +--
>  4 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 5ce48d8062fa..83c74b5b7e8e 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1192,17 +1192,18 @@ xfs_buf_ioerror_alert(
>  }
>  
>  /*
> - * To simulate an I/O failure, the buffer must be locked and held with at least
> - * two references.
> + * Fail a locked and referenced buffer outside the I/O path.
>   *
> - * The buf item reference is dropped via ioend processing. The second reference
> - * is owned by the caller and is dropped on I/O completion if the buffer is
> - * XBF_ASYNC.
> + * The caller transfers a reference which will be released after processing the
> + * error.
>   */
>  void
> -xfs_buf_ioend_fail(
> +xfs_buf_fail(
>  	struct xfs_buf	*bp)
>  {
> +	ASSERT(xfs_buf_islocked(bp));
> +
> +	bp->b_flags |= XBF_ASYNC;
>  	bp->b_flags &= ~XBF_DONE;
>  	xfs_buf_stale(bp);
>  	xfs_buf_ioerror(bp, -EIO);
> diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
> index b3cd1c7029f1..79cc9c3f0254 100644
> --- a/fs/xfs/xfs_buf.h
> +++ b/fs/xfs/xfs_buf.h
> @@ -290,7 +290,7 @@ extern void __xfs_buf_ioerror(struct xfs_buf *bp, int error,
>  		xfs_failaddr_t failaddr);
>  #define xfs_buf_ioerror(bp, err) __xfs_buf_ioerror((bp), (err), __this_address)
>  extern void xfs_buf_ioerror_alert(struct xfs_buf *bp, xfs_failaddr_t fa);
> -void xfs_buf_ioend_fail(struct xfs_buf *);
> +void xfs_buf_fail(struct xfs_buf *bp);
>  void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa);
>  #define xfs_buf_mark_corrupt(bp) __xfs_buf_mark_corrupt((bp), __this_address)
>  
> diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> index 8487635579e5..1f055cd6732e 100644
> --- a/fs/xfs/xfs_buf_item.c
> +++ b/fs/xfs/xfs_buf_item.c
> @@ -549,8 +549,7 @@ xfs_buf_item_unpin(
>  		 * wait for the lock and then run the IO failure completion.
>  		 */
>  		xfs_buf_lock(bp);
> -		bp->b_flags |= XBF_ASYNC;
> -		xfs_buf_ioend_fail(bp);
> +		xfs_buf_fail(bp);
>  		return;
>  	}
>  
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 317eb57f989f..15279d22a894 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2646,8 +2646,7 @@ xfs_iflush_cluster(
>  		 * inode cluster buffers.
>  		 */
>  		xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
> -		bp->b_flags |= XBF_ASYNC;
> -		xfs_buf_ioend_fail(bp);
> +		xfs_buf_fail(bp);
>  		return error;
>  	}
>  
> -- 
> 2.53.0
> 
> 

  reply	other threads:[~2026-06-25 18:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 13:58 xfs_buf_submit error handling fix v2 Christoph Hellwig
2026-06-25 13:58 ` [PATCH 1/6] xfs: open code xfs_buf_ioend_fail in xfs_buf_submit Christoph Hellwig
2026-06-25 13:58 ` [PATCH 2/6] xfs: also mark the buffer stale on verifier failure " Christoph Hellwig
2026-06-25 18:00   ` Darrick J. Wong
2026-06-26  4:35     ` Christoph Hellwig
2026-06-26  6:21       ` Darrick J. Wong
2026-06-26  6:23         ` Christoph Hellwig
2026-06-26 14:47           ` Darrick J. Wong
2026-06-25 13:58 ` [PATCH 3/6] xfs: improve the xfs_buf_ioend_fail calling convention Christoph Hellwig
2026-06-25 18:04   ` Darrick J. Wong [this message]
2026-06-25 13:58 ` [PATCH 4/6] xfs: remove xfs_buf_ioend Christoph Hellwig
2026-06-25 18:09   ` Darrick J. Wong
2026-06-25 13:58 ` [PATCH 5/6] xfs: fix handling of synchronous errors in xfs_buf_submit Christoph Hellwig
2026-06-25 18:13   ` Darrick J. Wong
2026-06-26  4:36     ` Christoph Hellwig
2026-06-25 13:58 ` [PATCH 6/6] xfs: simplify __xfs_buf_ioend Christoph Hellwig
2026-06-25 18:30   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2026-06-22  7:29 xfs_buf_submit error handling fix Christoph Hellwig
2026-06-22  7:30 ` [PATCH 3/6] xfs: improve the xfs_buf_ioend_fail calling convention Christoph Hellwig
2026-06-22 12:59   ` Carlos Maiolino
2026-06-24  7:42     ` Christoph Hellwig
2026-06-24  8:26       ` Carlos Maiolino
2026-06-24 13:44         ` Christoph Hellwig

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=20260625180423.GH6078@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=cmaiolino@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /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