Skip to contentSkip to conversation

btrfs: call btrfs_orig_bbio_end_io when btrfs_end_bio_work

PATCH In review Christoph Hellwig 3 participants 4 messages May 15, 2023 – May 22, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: call btrfs_orig_bbio_end_io when btrfs_end_bio_work

When I implemented the storage layer bio splitting, I was under the assumption that we'll never split metadata bios. But Qu reminded me that this can actually happen with very old file systems with unaligned metadata chunks and RAID0. I still haven't seen such a case in practice, but we better handled this case, especially as it is fairly easily to do not calling the ->end_іo method directly in btrfs_end_io_work, and using the proper btrfs_orig_bbio_end_io helper instead.

Fixes 103c19723c80 ("btrfs: split the bio submission path into a separate file")
---
 fs/btrfs/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/bio.c +1 -1
index 40cadab7df76a7..2d474ff7df601b 100644
@@ -357,7 +357,7 @@ static void btrfs_end_bio_work(struct work_struct *work)
 	if (is_data_bbio(bbio))
 		btrfs_check_read_bio(bbio, bbio->bio.bi_private);
 	else
-		bbio->end_io(bbio);
+		btrfs_orig_bbio_end_io(bbio);
 }
 
 static void btrfs_simple_end_io(struct bio *bio)
Signature · 1 line
2.39.2
#2 lore raw
Quoted 2 lines · Johannes Thumshirn

To add some context:

in addition to the old file system with unaligned metadata chunks case documented in the commit log, the combination of the new scrube code with Johannes pending raid-stripe-tree also triggers this case. We spent some time debugging it yesterday and found that this patch solves the problem.

#3 lore raw
In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig

When I implemented the storage layer bio splitting, I was under the assumption that we'll never split metadata bios. But Qu reminded me that this can actually happen with very old file systems with unaligned metadata chunks and RAID0. I still haven't seen such a case in practice, but we better handled this case, especially as it is fairly easily to do not calling the ->end_іo method directly in btrfs_end_io_work, and using the proper btrfs_orig_bbio_end_io helper instead.

Fixes 103c19723c80 ("btrfs: split the bio submission path into a separate file")

Added to misc-next, with an update to changelog with your additional explanation.

Commit 103c19723c80 is 6.2 but there are some intermediate changes so the backport won't be straightforward, for 6.3 it seems doable.