From: sashiko-bot@kernel.org
To: "David Strahan" <david.strahan@microchip.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v1 1/4] smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches.
Date: Wed, 22 Jul 2026 22:36:26 +0000 [thread overview]
Message-ID: <20260722223627.05DE61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722220401.6357-2-david.strahan@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] State leakage across blk-mq tag reuse leads to erroneous drive offlining. By registering `.init_cmd_priv`, the driver opts out of the SCSI core's per-dispatch zeroing of private command data, but fails to reliably clear `this_residual` on all completion paths.
--
--- Patch [1]: [PATCH v1 1/4] smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches. ---
commit 594ef5db683084e131dde7930f0e556c7584b609
Author: David Strahan <David.Strahan@microchip.com>
smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches.
This commit fixes an AIO retry loop issue by registering a per-command
initialization callback with the SCSI core to skip the per-dispatch clear.
This allows the retry marker to survive requeues, while the driver takes
over the responsibility of clearing it on terminal completion.
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index 5ec583dc2e7df..3a75b9fbedf45 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -66,6 +66,12 @@ static struct pqi_cmd_priv *pqi_cmd_priv(struct scsi_cmnd *cmd)
> return scsi_cmd_priv(cmd);
> }
>
> +static int pqi_init_cmd_priv(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
> +{
> + memset(pqi_cmd_priv(cmd), 0, sizeof(struct pqi_cmd_priv));
> + return 0;
> +}
> +
[ ... ]
> @@ -5958,6 +5964,17 @@ void pqi_prep_for_scsi_done(struct scsi_cmnd *scmd)
> struct pqi_scsi_dev *device;
> struct completion *wait;
>
> + /*
> + * Clear the AIO-retry marker on final completion so the tag
> + * starts clean on its next dispatch. On DID_IMM_RETRY leave
> + * it intact: pqi_aio_io_complete() sets DID_IMM_RETRY and
> + * bumps the marker to steer the requeue onto the RAID path,
> + * and pqi_process_raid_io_error() consumes the non-zero
> + * marker to offline a misbehaving drive.
> + */
> + if (host_byte(scmd->result) != DID_IMM_RETRY)
> + pqi_cmd_priv(scmd)->this_residual = 0;
> +
[Severity: High]
Does this reliably clear the marker on all completion paths?
If a command is aborted via the SCSI error handler, it can be terminated
directly by the SCSI midlayer via scsi_finish_command(), which bypasses
pqi_prep_for_scsi_done().
Because pqi_init_cmd_priv() prevents the core from zeroing the private data
on dispatch, a reused blk-mq tag could inherit this stale marker state.
If the dirty tag is subsequently used for a request to a physical drive and
encounters an ILLEGAL_REQUEST, it appears pqi_process_raid_io_error() could
misinterpret the leaked marker and erroneously offline a healthy drive:
pqi_process_raid_io_error() {
...
if (pqi_cmd_priv(scmd)->this_residual &&
!pqi_is_logical_device(scmd->device->hostdata) &&
scsi_status == SAM_STAT_CHECK_CONDITION &&
host_byte == DID_OK &&
sense_data_length &&
scsi_normalize_sense(error_info->data, sense_data_length, &sshdr) &&
sshdr.sense_key == ILLEGAL_REQUEST &&
sshdr.asc == 0x26 &&
sshdr.ascq == 0x0) {
host_byte = DID_NO_CONNECT;
pqi_take_device_offline(scmd->device, "AIO");
...
}
Could this lead to unintended drive offlining if the tag is reused?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722220401.6357-1-david.strahan@microchip.com?part=1
next prev parent reply other threads:[~2026-07-22 22:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 22:03 [PATCH v1 0/4] smartpqi: fixes and updates for 2.1.42-011 David Strahan
2026-07-22 22:03 ` [PATCH v1 1/4] smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches David Strahan
2026-07-22 22:36 ` sashiko-bot [this message]
2026-07-22 22:03 ` [PATCH v1 2/4] smartpqi: add support for CCISS_BIG_PASSTHRU ioctl David Strahan
2026-07-22 22:32 ` sashiko-bot
2026-07-22 22:04 ` [PATCH v1 3/4] smartpqi: add new pci device-ids David Strahan
2026-07-22 22:04 ` [PATCH v1 4/4] smartpqi: update version to 2.1.42-011 David Strahan
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=20260722223627.05DE61F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=david.strahan@microchip.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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