Re: [PATCH 2/2] block: copy BIO_ERROR_INJECTED to the split in bio_split()

From: Haris Iqbal

Date: Sat Dec 05 2026 - 07:59:53 EST




On 12/5/26 13:55, Md Haris Iqbal wrote:
BIO_ERROR_INJECTED keeps a bio that was delayed by an error injection
rule from being evaluated again when it is resubmitted. bio_split()
does not copy the flag to the split. raid10_handle_discard() resubmits
the front split of an unaligned discard to the md device, so a discard
delayed by a rule on that device has its front part evaluated, and
delayed, a second time.

Copy the flag in bio_split(), as is already done for
BIO_TRACE_COMPLETION.

Fixes: 6bd856cc9996 ("block: allow error injection rules to delay bios")
Signed-off-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxx>

This is the other one to drop.

---
block/bio.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/block/bio.c b/block/bio.c
index b0fcc69de653..0bf72f7b9f4d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1962,6 +1962,8 @@ struct bio *bio_split(struct bio *bio, int sectors,
if (bio_flagged(bio, BIO_TRACE_COMPLETION))
bio_set_flag(split, BIO_TRACE_COMPLETION);
+ if (bio_flagged(bio, BIO_ERROR_INJECTED))
+ bio_set_flag(split, BIO_ERROR_INJECTED);
return split;
}