Re: [PATCH v1 1/4] smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches.

David Strahan <[email protected]>
Newsgroups org.kernel.vger.linux-scsi
Message-ID <[email protected]>
Re: commit 594ef5db683084e131dde7930f0e556c7584b609
    [PATCH v1 1/4] smartpqi: Fix AIO retry marker cleared by SCSI core
    between dispatches.

Link: https://lore.kernel.org/linux-scsi/[email protected]/

Sashiko AI review (https://sashiko.dev/#/patchset/[email protected]?part=1):

> [Severity: High]
> State leakage across blk-mq tag reuse leads to erroneous drive
> offlining. [...] 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().

This driver registers its own .eh_abort_handler (pqi_eh_abort_handler())
and reset handlers, and never calls scsi_finish_command(). Every
completion path -- normal I/O, AIO retry, RAID error info, and the
controller-offline failure sweep -- goes through one choke point,
pqi_scsi_done(), which always calls pqi_prep_for_scsi_done() before
scsi_done():

    static inline void pqi_scsi_done(struct scsi_cmnd *scmd)
    {
            pqi_prep_for_scsi_done(scmd);
            scsi_done(scmd);
    }

pqi_eh_abort_handler() doesn't complete the command itself. It blocks
until pqi_prep_for_scsi_done() runs for that command. So by the time
the abort handler is allowed to return SUCCESS, the marker has already
been handled. There's no window for the bypass this review assumes.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.