Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] xfs: handle bio split errors during gc
@ 2025-10-20 14:43 Keith Busch
  2025-10-20 14:43 ` [PATCH 2/2] btrfs: handle bio split errors for append Keith Busch
  2025-10-20 14:45 ` [PATCH 1/2] xfs: handle bio split errors during gc Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Busch @ 2025-10-20 14:43 UTC (permalink / raw)
  To: dsterba, cem, linux-btrfs, linux-xfs, hch; +Cc: Keith Busch, Chris Mason

From: Keith Busch <kbusch@kernel.org>

bio_split_rw_at may return a negative error value if the bio can not be
split into anything that adheres to the block device's queue limits.
Check for that condition and fail the bio accordingly.

Reported-by: Chris Mason <clm@fb.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 fs/xfs/xfs_zone_gc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index 064cd1a857a02..24799715efdc4 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -765,6 +765,8 @@ xfs_zone_gc_split_write(
 			lim->max_zone_append_sectors << SECTOR_SHIFT);
 	if (!split_sectors)
 		return NULL;
+	if (split_sectors < 0)
+		return ERR_PTR(split_sectors);
 
 	/* ensure the split chunk is still block size aligned */
 	split_sectors = ALIGN_DOWN(split_sectors << SECTOR_SHIFT,
@@ -819,8 +821,16 @@ xfs_zone_gc_write_chunk(
 	bio_add_folio_nofail(&chunk->bio, chunk->scratch->folio, chunk->len,
 			offset_in_folio(chunk->scratch->folio, bvec_paddr));
 
-	while ((split_chunk = xfs_zone_gc_split_write(data, chunk)))
+	while (!IS_ERR_OR_NULL(split_chunk = xfs_zone_gc_split_write(data, chunk)))
 		xfs_zone_gc_submit_write(data, split_chunk);
+
+	if (IS_ERR(split_chunk)) {
+		chunk->bio.bi_status = errno_to_blk_status(PTR_ERR(
+								split_chunk));
+		bio_endio(&chunk->bio);
+		return;
+	}
+
 	xfs_zone_gc_submit_write(data, chunk);
 }
 
-- 
2.47.3


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

end of thread, other threads:[~2025-10-21 21:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 14:43 [PATCH 1/2] xfs: handle bio split errors during gc Keith Busch
2025-10-20 14:43 ` [PATCH 2/2] btrfs: handle bio split errors for append Keith Busch
2025-10-21 21:03   ` kernel test robot
2025-10-20 14:45 ` [PATCH 1/2] xfs: handle bio split errors during gc Christoph Hellwig
2025-10-20 14:54   ` Keith Busch
2025-10-20 14:57     ` Christoph Hellwig
2025-10-20 15:05       ` Keith Busch
2025-10-20 15:16       ` Chris Mason
2025-10-21  5:28         ` Christoph Hellwig

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