Re: [PATCH] btrfs: fix NULL end_io call when submitting a repair read fails
From: Johannes Thumshirn
Date: Tue Nov 24 2026 - 01:38:02 EST
On 11/23/26 6:56 PM, Miroslav Cimerman wrote:
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index efbce4d549ff..46df424e9667 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -840,6 +840,19 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
btrfs_bio_end_io(remaining, status);
}
end_bbio:
+ /*
+ * A repair bio has no end_io callback. Complete it like a failed read
+ * of its mirror, from the end I/O workqueue. The repair code then tries
+ * the next mirror. A direct call would nest once per mirror.
+ */
+ if (bbio->bio.bi_pool == &btrfs_repair_bioset) {
+ bbio->mirror_num = mirror_num;
+ bbio->saved_iter = bbio->bio.bi_iter;
+ bbio->bio.bi_status = status;
+ INIT_WORK(&bbio->end_io_work, simple_end_io_work);
+ queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work);
+ return true;
+ }
Maybe I'm missing something (sorry wall of text in the commit message and 7am here), but isn't it enough to set a dummy endio (like Qu also suggested) and then bio_io_error() out?