Skip to content

Commit 8604f63

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: core: Fix command pass through retry regression
scsi_check_passthrough() is always called, but it doesn't check for if a command completed successfully. As a result, if a command was successful and the caller used SCMD_FAILURE_RESULT_ANY to indicate what failures it wanted to retry, we will end up retrying the command. This will cause delays during device discovery because of the command being sent multiple times. For some USB devices it can also cause the wrong device size to be used. This patch adds a check for if the command was successful. If it is we return immediately instead of trying to match a failure. Fixes: 994724e ("scsi: core: Allow passthrough to request midlayer retries") Reported-by: Kris Karas <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219652 Signed-off-by: Mike Christie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3b2f568 commit 8604f63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ static int scsi_check_passthrough(struct scsi_cmnd *scmd,
210210
struct scsi_sense_hdr sshdr;
211211
enum sam_status status;
212212

213+
if (!scmd->result)
214+
return 0;
215+
213216
if (!failures)
214217
return 0;
215218

0 commit comments

Comments
 (0)