Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] scsi: Replace FC-specific jammer with transport-agnostic fault injector
@ 2026-05-06 14:09 Laurence Oberman
  2026-05-06 14:09 ` [PATCH v2 1/2] scsi: tcm_qla2xxx: Remove FC-specific SCSI command jammer Laurence Oberman
  2026-05-06 14:09 ` [PATCH v2 2/2] scsi: Add transport-agnostic initiator-side fault injector Laurence Oberman
  0 siblings, 2 replies; 3+ messages in thread
From: Laurence Oberman @ 2026-05-06 14:09 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, martin.petersen, loberman

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

-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-06 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 14:09 [PATCH v2 0/2] scsi: Replace FC-specific jammer with transport-agnostic fault injector Laurence Oberman
2026-05-06 14:09 ` [PATCH v2 1/2] scsi: tcm_qla2xxx: Remove FC-specific SCSI command jammer Laurence Oberman
2026-05-06 14:09 ` [PATCH v2 2/2] scsi: Add transport-agnostic initiator-side fault injector Laurence Oberman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox