public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Donald Douwsma <ddouwsma@redhat.com>
To: Long Li <leo.lilong@huawei.com>, djwong@kernel.org, cem@kernel.org
Cc: linux-xfs@vger.kernel.org, david@fromorbit.com,
	yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com,
	lonuxli.64@gmail.com
Subject: Re: [PATCH 1/3] xfs: handle ERR_PTR return from bio_split in xfs_buf_submit_bio
Date: Tue, 21 Apr 2026 18:18:54 +1000	[thread overview]
Message-ID: <3ac237a7-29b0-4021-be81-413b4d858be8@redhat.com> (raw)
In-Reply-To: <20260418092715.375850-2-leo.lilong@huawei.com>

On 18/4/26 19:27, Long Li wrote:
> bio_split() now returns ERR_PTR() on failure rather than NULL.
> xfs_buf_submit_bio() currently ignores the return value and
> dereferences it unconditionally, which will crash on error.
> 
> Add an IS_ERR() check after bio_split(). On failure, flush the plug
> to dispatch any already-chained split bios, then call bio_endio()
> with BLK_STS_IOERR on the parent bio. Because bio_chain() increments
> the parent's bi_remaining for each chained child, the end_io callback
> fires only after all children complete, propagating the error back to
> xfs_buf through the normal path.
> 
> Fixes: e546fe1da9bd ("block: Rework bio_split() return value")

This looks like it could cause problems further back?
Perhaps 
    fac69ec8cd74 xfs: simplify buffer I/O submission


Don


> Signed-off-by: Long Li <leo.lilong@huawei.com>
> ---
>  fs/xfs/xfs_buf.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 580d40a5ee57..fda215dd00df 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1268,6 +1268,12 @@ xfs_buf_submit_bio(
>  
>  		split = bio_split(bio, bp->b_maps[map].bm_len, GFP_NOFS,
>  				&fs_bio_set);
> +		if (IS_ERR(split)) {
> +			blk_finish_plug(&plug);
> +			bio->bi_status = BLK_STS_IOERR;
> +			bio_endio(bio);
> +			return;
> +		}
>  		split->bi_iter.bi_sector = bp->b_maps[map].bm_bn;
>  		bio_chain(split, bio);
>  		submit_bio(split);


  reply	other threads:[~2026-04-21  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-18  9:27 [PATCH 0/3] xfs: handle ERR_PTR return from bio_split Long Li
2026-04-18  9:27 ` [PATCH 1/3] xfs: handle ERR_PTR return from bio_split in xfs_buf_submit_bio Long Li
2026-04-21  8:18   ` Donald Douwsma [this message]
2026-04-18  9:27 ` [PATCH 2/3] xfs: handle ERR_PTR return from bio_split in xlog_write_iclog Long Li
2026-04-18  9:27 ` [PATCH 3/3] xfs: handle ERR_PTR return from bio_split in xfs_zone_gc_split_write Long Li
2026-04-21  8:29 ` [PATCH 0/3] xfs: handle ERR_PTR return from bio_split Carlos Maiolino

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=3ac237a7-29b0-4021-be81-413b4d858be8@redhat.com \
    --to=ddouwsma@redhat.com \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=houtao1@huawei.com \
    --cc=leo.lilong@huawei.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=lonuxli.64@gmail.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.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