The patch below does not apply to the 6.3-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.3.y git checkout FETCH_HEAD git cherry-pick -x 45c2f36871955b51b4ce083c447388d8c72d6b91 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023060510-euphemism-budget-adac@gregkh' --subject-prefix 'PATCH 6.3.y' HEAD^.. Possible dependencies: 45c2f3687195 ("btrfs: call btrfs_orig_bbio_end_io in btrfs_end_bio_work") 4317ff0056be ("btrfs: introduce btrfs_bio::fs_info member") 2cef0c79bb81 ("btrfs: make btrfs_split_bio work on struct btrfs_bio") b41bbd293e64 ("btrfs: return a btrfs_bio from btrfs_bio_alloc") 9dfde1b47b9d ("btrfs: store a pointer to a btrfs_bio in struct btrfs_bio_ctrl") d733ea012db3 ("btrfs: simplify finding the inode in submit_one_bio") 690834e47cf7 ("btrfs: pass a btrfs_bio to btrfs_submit_compressed_read") ae42a154ca89 ("btrfs: pass a btrfs_bio to btrfs_submit_bio") 34f888ce3a35 ("btrfs: cleanup main loop in btrfs_encoded_read_regular_fill_pages") 198bd49e5f0c ("btrfs: sink calc_bio_boundaries into its only caller") 24e6c8082208 ("btrfs: simplify main loop in submit_extent_page") 78a2ef1b7b33 ("btrfs: check for contiguity in submit_extent_page") 551733372fda ("btrfs: remove the submit_extent_page return value") f8ed4852f3a9 ("btrfs: remove the compress_type argument to submit_extent_page") a140453bf9fb ("btrfs: rename the this_bio_flag variable in btrfs_do_readpage") c9bc621fb498 ("btrfs: move the compress_type check out of btrfs_bio_add_page") 72b505dc5757 ("btrfs: add a wbc pointer to struct btrfs_bio_ctrl") 794c26e214ab ("btrfs: remove the sync_io flag in struct btrfs_bio_ctrl") c000bc04bad4 ("btrfs: store the bio opf in struct btrfs_bio_ctrl") eb8d0c6d042f ("btrfs: remove the force_bio_submit to submit_extent_page") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 45c2f36871955b51b4ce083c447388d8c72d6b91 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@xxxxxx> Date: Mon, 15 May 2023 11:18:21 +0200 Subject: [PATCH] btrfs: call btrfs_orig_bbio_end_io in btrfs_end_bio_work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. In addition to the old file system with unaligned metadata chunks case documented in the commit log, the combination of the new scrub code with Johannes pending raid-stripe-tree also triggers this case. We spent some time debugging it and found that this patch solves the problem. Fixes: 103c19723c80 ("btrfs: split the bio submission path into a separate file") CC: stable@xxxxxxxxxxxxxxx # 6.3+ Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Tested-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 5379c4714905..35d34c731d72 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -330,7 +330,7 @@ static void btrfs_end_bio_work(struct work_struct *work) if (bbio->inode && !(bbio->bio.bi_opf & REQ_META)) 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)