scsi: Replace FC-specific jammer with transport-agnostic fault injector
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 1 replyIn review
- v12 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- Patch 2: Add jam_tur_passthrough control to pass TEST UNIT READY commands through while jamming all other commands. Simulates slow-drain where path appears alive to multipath but data I/O is stalled.
- Patch 1: unchanged
- Fix duplicate flap_work_fn forward declaration in patch 2
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | scsi: tcm_qla2xxx: Remove FC-specific SCSI command jammerdrivers/ drivers/ drivers/ | +0 | 0 replies | |
| 2/2 | scsi: Add transport-agnostic initiator-side fault injectorMAINTAINERS drivers/ drivers/ +1 more | +703 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by.
| Patch | Laurence Oberman |
|---|---|
| 1/2 | |
| 2/2 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/2] scsi: Replace FC-specific jammer with transport-agnostic fault injector
This two-patch series replaces the FC-specific SCSI command jammer introduced in commit 54a5e73f4d6e ("tcm_qla2xxx Add SCSI command jammer/discard capability") with a transport-agnostic initiator-side fault injection module.
The original implementation required LIO configured in target mode with a QLogic qla2xxx HBA, limiting it to FC environments only. tcm_qla2xxx target mode has effectively been retired, making the original approach no longer viable as a general-purpose test tool.
The replacement module (scsi_jammer) operates on the initiator side at the queuecommand level of the SCSI mid-layer. It intercepts commands before they reach any HBA driver by saving and replacing the queuecommand function pointer of the selected Scsi_Host at runtime. This makes it equally effective for FC, FCoE, iSCSI, SAS, and any other transport that presents a Scsi_Host, with no target-side configuration required.
Three injection modes simulate different fabric failure scenarios:
- drop: immediate DID_NO_CONNECT (dead path / cable pull)
- timeout: delayed completion beyond SCSI timeout (slow drain)
- flap: periodic arm/disarm (repeated RSCN events)
The flap mode is particularly useful for testing dm-multipath path reinstatement logic in addition to initial failover.
An optional jam_tur_passthrough knob lets TEST UNIT READY commands pass through to the real driver while all other commands are jammed. This simulates the real-world slow-drain failure mode where the path appears alive to dm-multipath path checkers but data I/O is stalled.
Safety: commands are never silently dropped; every intercepted command is completed via scsi_done() either immediately or from a workqueue timer. The initiator will not panic or be left with orphaned commands regardless of when the module is unloaded.
This patch series was developed with the assistance of Claude AI (Anthropic). The design, testing, and sign-off responsibility remain with the author.
Tested on x86_64 with Emulex lpfc FC HBA, dm-multipath, Linux 7.0.0+. All three injection modes and TUR passthrough verified against active multipath configurations.
Note to reviewers: checkpatch reports 4 CHECKs on patch 2/2, all of which are false positives:
- "Alignment should match open parenthesis": checkpatch miscounts tabs for enum return types; alignment is correct.
- "Lines should not end with a '('": common kernel pattern.
- "Macro argument reuse '_var'" (x2): READ_ONCE/WRITE_ONCE are specifically designed to be safe with macro argument reuse; this is a known false positive for these accessors.
Changes since v1:
- Patch 2: Add jam_tur_passthrough control to pass TEST UNIT READY commands through while jamming all other commands. Simulates slow-drain where path appears alive to multipath but data I/O is stalled.
- Patch 1: unchanged
- Fix duplicate flap_work_fn forward declaration in patch 2
Laurence Oberman (2):
scsi: tcm_qla2xxx: Remove FC-specific SCSI command jammer
scsi: Add transport-agnostic initiator-side fault injector
MAINTAINERS | 6 + drivers/scsi/Kconfig | 22 + drivers/scsi/Makefile | 1 + drivers/scsi/qla2xxx/Kconfig | 9 - drivers/scsi/qla2xxx/tcm_qla2xxx.c | 23 - drivers/scsi/qla2xxx/tcm_qla2xxx.h | 1 - drivers/scsi/scsi_jammer.c | 657 +++++++++++++++++++++++++++++ 7 files changed, 686 insertions(+), 33 deletions(-) create mode 100644 drivers/scsi/scsi_jammer.c
Signature · 1 line
2.54.0