Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit

From: Darrick J. Wong

Date: Wed Mar 04 2026 - 14:53:13 EST


On Wed, Mar 04, 2026 at 07:59:20PM +0100, Andreas Gruenbacher wrote:
> Function xfs_zone_alloc_and_submit() sets bio->bi_status and then it
> calls bio_io_error() which overwrites that value again. Fix that by
> completing the bio separately after setting bio->bi_status.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>

Yeah, that make sense to me that we shouldn't override the value set in
out_split_error.

Cc: <stable@xxxxxxxxxxxxxxx> # v6.15
Fixes: 4e4d5207557770 ("xfs: add the zoned space allocator")
Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

--D

> ---
> fs/xfs/xfs_zone_alloc.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index e3d19b6dc64a..c3328b9dda37 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -862,7 +862,7 @@ xfs_zone_alloc_and_submit(
> bool is_seq;
>
> if (xfs_is_shutdown(mp))
> - goto out_error;
> + goto out_io_error;
>
> /*
> * If we don't have a locally cached zone in this write context, see if
> @@ -875,7 +875,7 @@ xfs_zone_alloc_and_submit(
> select_zone:
> *oz = xfs_select_zone(mp, write_hint, pack_tight);
> if (!*oz)
> - goto out_error;
> + goto out_io_error;
> xfs_set_cached_zone(ip, *oz);
> }
>
> @@ -902,7 +902,10 @@ xfs_zone_alloc_and_submit(
>
> out_split_error:
> ioend->io_bio.bi_status = errno_to_blk_status(PTR_ERR(split));
> -out_error:
> + bio_endio(&ioend->io_bio);
> + return;
> +
> +out_io_error:
> bio_io_error(&ioend->io_bio);
> }
>
> --
> 2.52.0
>
>