public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
@ 2026-03-04 18:59 Andreas Gruenbacher
  2026-03-04 19:53 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 18:59 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: Andreas Gruenbacher, linux-xfs, linux-kernel

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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-04 18:59 [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
@ 2026-03-04 19:53 ` Darrick J. Wong
  2026-03-05  9:05   ` Carlos Maiolino
  2026-03-05  9:47 ` Carlos Maiolino
  2026-03-05 14:02 ` Christoph Hellwig
  2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2026-03-04 19:53 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: Carlos Maiolino, linux-xfs, linux-kernel

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@redhat.com>

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

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

--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
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-04 19:53 ` Darrick J. Wong
@ 2026-03-05  9:05   ` Carlos Maiolino
  0 siblings, 0 replies; 7+ messages in thread
From: Carlos Maiolino @ 2026-03-05  9:05 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Andreas Gruenbacher, linux-xfs, linux-kernel

On Wed, Mar 04, 2026 at 11:53:03AM -0800, Darrick J. Wong wrote:
> 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@redhat.com>
> 
> Yeah, that make sense to me that we shouldn't override the value set in
> out_split_error.
> 
> Cc: <stable@vger.kernel.org> # v6.15
> Fixes: 4e4d5207557770 ("xfs: add the zoned space allocator")
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

I can add that at commit time, no need to send again Andreas.


For the patch itself:
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> 
> --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
> > 
> > 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-04 18:59 [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
  2026-03-04 19:53 ` Darrick J. Wong
@ 2026-03-05  9:47 ` Carlos Maiolino
  2026-03-05 14:02 ` Christoph Hellwig
  2 siblings, 0 replies; 7+ messages in thread
From: Carlos Maiolino @ 2026-03-05  9:47 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-xfs, linux-kernel

On Wed, 04 Mar 2026 19:59:20 +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.
> 
> 

Applied to for-next, thanks!

[1/1] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
      commit: 5be2161f245bab6aaf0723fdd0c9635dfcaf9de5

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-04 18:59 [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
  2026-03-04 19:53 ` Darrick J. Wong
  2026-03-05  9:47 ` Carlos Maiolino
@ 2026-03-05 14:02 ` Christoph Hellwig
  2026-03-05 16:20   ` Carlos Maiolino
  2026-03-05 18:09   ` Andreas Gruenbacher
  2 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2026-03-05 14:02 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: Carlos Maiolino, linux-xfs, linux-kernel

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.

Looks good, but can you drop the pointless goto label renaming?
I'd also be tempted to just open code the split error case instead
of adding a label for it.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-05 14:02 ` Christoph Hellwig
@ 2026-03-05 16:20   ` Carlos Maiolino
  2026-03-05 18:09   ` Andreas Gruenbacher
  1 sibling, 0 replies; 7+ messages in thread
From: Carlos Maiolino @ 2026-03-05 16:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Andreas Gruenbacher, linux-xfs, linux-kernel

On Thu, Mar 05, 2026 at 06:02:51AM -0800, Christoph Hellwig wrote:
> 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.
> 
> Looks good, but can you drop the pointless goto label renaming?
> I'd also be tempted to just open code the split error case instead
> of adding a label for it.
> 

/me goes pull it off the next pull-request

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit
  2026-03-05 14:02 ` Christoph Hellwig
  2026-03-05 16:20   ` Carlos Maiolino
@ 2026-03-05 18:09   ` Andreas Gruenbacher
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Gruenbacher @ 2026-03-05 18:09 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs, linux-kernel

On Thu, Mar 5, 2026 at 5:34 PM Christoph Hellwig <hch@infradead.org> wrote:
> 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.
>
> Looks good, but can you drop the pointless goto label renaming?
> I'd also be tempted to just open code the split error case instead
> of adding a label for it.

Feel free to adjust things as you see fit.

Andreas


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-05 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 18:59 [PATCH] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
2026-03-04 19:53 ` Darrick J. Wong
2026-03-05  9:05   ` Carlos Maiolino
2026-03-05  9:47 ` Carlos Maiolino
2026-03-05 14:02 ` Christoph Hellwig
2026-03-05 16:20   ` Carlos Maiolino
2026-03-05 18:09   ` Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox