Re: [v4 0/3] block: delay support for error injection

From: Christoph Hellwig

Date: Wed Dec 02 2026 - 03:02:34 EST


On Tue, Dec 01, 2026 at 10:34:16PM +0100, Haris Iqbal wrote:
> I was looking into the report and the scenarios, and I think part of this
> is real, but I'm not sure the rest can happen.
>
> The delayed bio is resubmitted through submit_bio_noacct_nocheck(), which
> skips bio_check_eod(). If the disk is removed while the bio waits, I think
> the bio can still reach the driver on sd/sr, because their queue is
> unfrozen again after del_gendisk(). So this part makes sense and I think
> failing the bio in the work when GD_DEAD should fix it.

Yes.

>
> I don't think the use-after-free through nvme multipath can happen. Path
> disks are hidden, so their bdev is never added and disk_live() is false,
> and error_inject_add() returns -ENODEV for a disk that isn't live. I tried
> it with nvme-loop: writing a rule to the path disk's eror_injection file
> fails with ENODEV. If that's right, a bio is never delayed on a path disk,
> only on the head disk.

Ok.

> So I'm thinking of adding just the GD_DEAD check. One thing I'd like an
> opinion on: a delayed bio holds no q_usage_counter, so del_gendisk()
> doesn't wait for it, and only the issuer's open keeps the disk allocated.
> Is that fine to rely on, or should the delayed bio take its own reference
> on the bdev (and the driver module) for the duration of the delay?

I think clearing BIO_ERROR_INJECTED on remapping is also still needed.