scsi: Only return started requests from scsi_host_find_tag()
PATCH 1/1 scsi: Only return started requests from scsi_host_find_tag()
scsi_host_find_tag() is used by the drivers to return a scsi command based on the command tag. Typically it's used from the interrupt handler to fetch the command associated with a value returned from hardware. Some drivers like fnic or qla4xxx, however, also use it also to traverse outstanding comands.
With the current implementation scsi_host_find_tag() will return command even if they are not started (ie passed to the driver). This will result in random errors with those drivers. With this patch scsi_host_find_tag() will only return 'started' commands (ie commands which have been passed to the drivers) thus avoiding the above issue.
The other usecases will be unaffected as the interrupt handler naturally will only ever return 'started' requests.
--- include/scsi/scsi_tcq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/scsi/scsi_tcq.h +1 -1
@@ -34,7 +34,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, blk_mq_unique_tag_to_tag(tag)); } -if (!req) +if (!req || !blk_mq_request_started (req))return NULL ;return blk_mq_rq_to_pdu (req); }
Signature · 1 line
2.16.4
Martin K. Petersen
AppliedQuoted 5 lines · Hannes Reinecke
scsi_host_find_tag()is used by the drivers to return a scsi command based on the command tag. Typically it's used from the interrupt handler to fetch the command associated with a value returned from hardware. Some drivers like fnic or qla4xxx, however, also use it also to traverse outstanding comands.
Quoted 8 lines
With the current implementation
scsi_host_find_tag()will return command even if they are not started (ie passed to the driver). This will result in random errors with those drivers. With this patchscsi_host_find_tag()will only return 'started' commands (ie commands which have been passed to the drivers) thus avoiding the above issue.
The other usecases will be unaffected as the interrupt handler naturally will only ever return 'started' requests.
Applied to 5.9/scsi-queue, thanks!
[1/1] scsi: core: Only return started requests from scsi_host_find_tag()
https://git.kernel.org/mkp/scsi/c/e73a5e8e8003
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering