diff mbox series

btrfs: call btrfs_orig_bbio_end_io when btrfs_end_bio_work

Message ID 20230515091821.304310-1-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series btrfs: call btrfs_orig_bbio_end_io when btrfs_end_bio_work | expand

Commit Message

Christoph Hellwig May 15, 2023, 9:18 a.m. UTC
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")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Thumshirn May 19, 2023, 3:09 p.m. UTC | #1
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Christoph Hellwig May 20, 2023, 4:48 a.m. UTC | #2
On Fri, May 19, 2023 at 03:09:23PM +0000, Johannes Thumshirn wrote:
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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.
David Sterba May 22, 2023, 10:12 p.m. UTC | #3
On Mon, May 15, 2023 at 11:18:21AM +0200, Christoph Hellwig wrote:
> 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")
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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.
diff mbox series

Patch

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 40cadab7df76a7..2d474ff7df601b 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -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)