diff options
| author | Md Haris Iqbal <haris.iqbal@linux.dev> | 2026-11-11 22:58:37 +0100 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-11-18 09:06:32 -0700 |
| commit | 6bd856cc99963b786cb530141745ef733de76cc3 (patch) | |
| tree | 11ddc3cce8d6655dffb82898f7bd633be28d2348 /kernel/debug | |
| parent | d239710cf3e6bd5fec66766957c3752d9cfbd2c5 (diff) | |
block: allow error injection rules to delay bios
Error injection can only fail a bio today. Add a delay_us option so that
a rule can hold a bio back first, to model a slow device.
If a matching rule has delay_us set, the bio is held for that long. It is
then failed if the rule also has a status, or resubmitted otherwise.
The resubmission is done through submit_bio_noacct_nocheck(), which is
where the injection hook sits. To avoid the same delay rule being applied
to it again, mark the bio with the BIO_ERROR_INJECTED flag as soon as a
rule matches. This also prevents bios that are split later and resubmitted
from being evaluated for delay (or error injection) again. __bio_clone()
does not propagate the flag, so a clone a stacking driver aims at a lower
device is still evaluated.
The bio is submitted from a workqueue rather than from the timer, because
submitting a bio can sleep. A REQ_NOWAIT bio is failed with BLK_STS_AGAIN
instead of being delayed. Values above 600 seconds are rejected.
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Md Haris Iqbal <haris.iqbal@linux.dev>
Link: https://patch.msgid.link/20261111215838.103356-3-haris.iqbal@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/debug')
0 files changed, 0 insertions, 0 deletions
