From: Laurence Oberman <loberman@redhat.com>
To: linux-scsi@vger.kernel.org
Cc: James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, loberman@redhat.com
Subject: [PATCH v2 0/2] scsi: Replace FC-specific jammer with transport-agnostic fault injector
Date: Wed, 6 May 2026 10:09:32 -0400 [thread overview]
Message-ID: <20260506140934.1005361-1-loberman@redhat.com> (raw)
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
next reply other threads:[~2026-05-06 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 14:09 Laurence Oberman [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506140934.1005361-1-loberman@redhat.com \
--to=loberman@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox