scsi: core: Fix passthrough retry counter handling
authorMike Christie <michael.christie@oracle.com>
Fri, 12 Aug 2022 01:12:06 +0000 (20:12 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 20 Aug 2022 01:39:47 +0000 (21:39 -0400)
commitfac8e558da9485e13a0ae0488aa0b8a8c307cd34
treeccfc4ba3e42aeabce64feb183cbea5fd8653c201
parent8f2c96420c6ec3dcb18c8be923e24c6feaa5ccf6
scsi: core: Fix passthrough retry counter handling

Passthrough users will set the scsi_cmnd->allowed value and were expecting
up to $allowed retries. The problem is that before:

commit 6aded12b10e0 ("scsi: core: Remove struct scsi_request")

we used to set the retries on the scsi_request then copy them over to
scsi_cmnd->allowed in scsi_setup_scsi_cmnd. With that patch we now set
scsi_cmnd->allowed to 0 in scsi_prepare_cmd and overwrite what the
passthrough user set.

This moves the allowed initialization to after the blk_rq_is_passthrough()
check so it's only done for the non-passthrough path where the ULD
init_command will normally set an allowed value it prefers.

Link: https://lore.kernel.org/r/20220812011206.9157-1-michael.christie@oracle.com
Fixes: 6aded12b10e0 ("scsi: core: Remove struct scsi_request")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_lib.c