Skip to content

block: delay support for error injection - #1370

Open
blktests-ci-kpd[bot] wants to merge 3 commits into
for-next_basefrom
series/1175637=>for-next
Open

blktests-ci-kpd[bot] wants to merge 3 commits into
for-next_basefrom
series/1175637=>for-next

Conversation

@blktests-ci-kpd

Copy link
Copy Markdown

Pull request for series with
subject: block: delay support for error injection
version: 3
url: https://patchwork.kernel.org/series/1175637/

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 3769bc3
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 648611e
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 67cd826
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1175637=>for-next branch from 2eda9c1 to 9736bc2 Compare October 3, 2026 09:46
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 67cd826
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 0f7ca97
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: c71f470
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 1f50498
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 4da93ac
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: e8b704b
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1175637=>for-next branch from 11bc469 to f765d0b Compare October 13, 2026 21:45
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 75b36d2
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 5219caf
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 34fbfb9
series: https://patchwork.kernel.org/series/1175637/
version: 3

Md Haris Iqbal added 3 commits October 19, 2026 17:56
tag_to_blk_status() returns BLK_STS_OK both for the "OK" tag and for a
tag it does not recognize, so a caller cannot tell the two apart. The
block error injection code (which is the sole user of this function
currently) relies on error_inject_add() later to reject adding a rule with
status=BLK_STS_OK. This is okay for the current state of error injection.

The delay option added in the next commit makes the rule with status=OK
valid, meaning the function tag_to_blk_status() now needs to explicitly
match BLK_STS_OK for it, and fail for a tag it does not recognize. Hence
make tag_to_blk_status() take a second param to update the matched status,
and return true in case of a successful match. If a match is not found,
the function tag_to_blk_status() returns false and *status remains
unchanged.

A repeated status= where an invalid tag comes first is now rejected
instead of being overridden by the later one.

Cc: Christoph Hellwig <hch@lst.de>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Md Haris Iqbal <haris.iqbal@linux.dev>
Reviewed-by: Christoph Hellwig <hch@lst.de>
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 before queueing
the work in blk_error_inject_delay(). 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. Bios with REQ_NOWAIT are never delayed, and
values above 600 seconds are rejected.

Cc: Christoph Hellwig <hch@lst.de>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Md Haris Iqbal <haris.iqbal@linux.dev>
Document the delay_us option: the delay happens above the driver, a
delayed bio is not run through the rules again, and holding a bio back
reorders it against bios submitted later.

Cc: Christoph Hellwig <hch@lst.de>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Md Haris Iqbal <haris.iqbal@linux.dev>
Reviewed-by: Christoph Hellwig <hch@lst.de>
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: f9d56ee
series: https://patchwork.kernel.org/series/1175637/
version: 3

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1175637=>for-next branch from 2a494bb to 04e5f4b Compare October 19, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants