Skip to content

block: delay support for error injection

Md Haris Iqbal linux-block linux-doc lkml 4 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 9 repliesApplied
  2. v33 patches 15 repliesSuperseded
  3. v23 patches 7 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC3 patches4 repliesSuperseded

Changes in v4 from the cover letter

- Patch 2: share the failure path in a helper, return early in the work function, fail REQ_NOWAIT bios with BLK_STS_AGAIN instead of skipping the delay, warn when a delay can't be allocated, set the flag as soon as a rule matches, and drop comments that state the obvious.

- Patch 3: document that REQ_NOWAIT bios fail with BLK_STS_AGAIN.

- All patches: drop the Assisted-by tag, following commit 1e035297ffda ("docs: remove Assisted-by references").

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3block: Reject unknown status tags in error injection rulesblock/blk-core.c block/blk.h block/error-injection.c+11 -121 reply
2/3block: allow error injection rules to delay biosblock/error-injection.c block/error-injection.h include/linux/blk_types.h+130 -151 reply
3/3Documentation: block: document error injection delay featureDocumentation/block/error-injection.rst+34 -51 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/3R-b
2/3
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

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

Error injection can only fail a bio today. This adds a delay_us option so that a rule can hold a bio back first, to model a slow device. The delay happens above the driver, so it tests the code waiting above the block layer, not the blk-mq timeout handler.

A delayed bio is marked with a new BIO_ERROR_INJECTED flag so the rules are not applied to it again, even after a split. Christoph asked on v2 to avoid the flag by allowing a delay only together with an error. I kept delay-only rules, as a slow device that succeeds is the more useful case, so the flag question is still open.

Holding a bio back reorders it against bios submitted later, which breaks sequential write ordering on zoned devices.

Patch 1 is a prep cleanup. It moves the rejection of an unknown status tag into the parser, because patch 2 makes a rule without a status valid.

Tested in a VM.

Claude helped with parts of patch 2 and the documentation, and was used to review the series before each posting. I went through all of it and tested it myself.

v1: https://lore.kernel.org/linux-block/[email protected]/
v2: https://lore.kernel.org/linux-block/[email protected]/
v3: https://lore.kernel.org/linux-block/[email protected]/

Changes since v3:

- Patch 2: share the failure path in a helper, return early in the work function, fail REQ_NOWAIT bios with BLK_STS_AGAIN instead of skipping the delay, warn when a delay can't be allocated, set the flag as soon as a rule matches, and drop comments that state the obvious.

- Patch 3: document that REQ_NOWAIT bios fail with BLK_STS_AGAIN.

- All patches: drop the Assisted-by tag, following commit 1e035297ffda ("docs: remove Assisted-by references").

Changes since v2:

- Patch 1: return bool, rewrite the commit message.

- Patch 2: drop __submit_bio_noacct_nocheck(); the flag alone stops the rules being applied again. Log the error when a delayed bio is failed.

- Patch 3: trim the documentation.

Changes since v1:

- Add the BIO_ERROR_INJECTED bio flag. v1 only resubmitted a delayed bio below the injection hook, which left the remainder of a split going through the hook and matching the same rule again, so a bio was held once per split instead of once.

- Patch 1: tag_to_blk_status() returns an error and passes the status back through a pointer, instead of returning BLK_STS_OK for both the "OK" tag and an unknown one. A delay-only rule has no status, so the two have to be told apart.

- Documentation: a delayed bio is held once rather than once per split.

Md Haris Iqbal (3):
block: Reject unknown status tags in error injection rules
block: allow error injection rules to delay bios
Documentation: block: document error injection delay feature

 Documentation/block/error-injection.rst |  39 +++++-
 block/blk-core.c                        |  14 +--
 block/blk.h                             |   2 +-
 block/error-injection.c                 | 150 +++++++++++++++++++++---
 block/error-injection.h                 |   1 +
 include/linux/blk_types.h               |   1 +
 6 files changed, 175 insertions(+), 32 deletions(-)
Signature · 1 line
2.53.0