Blob Blame History Raw
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 05 Nov 2021 15:43:45 +0600
Subject: [PATCH] SCSI: scsi_probe_lun: retry INQUIRY after timeout
References: bsc#1189297
Patch-mainline: Never, upstream will use a different approach that can't be backported

Currently scsi_probe_lun() retries only for certain types of UNIT ATTENTION.
With this patch, it should also retry after a timeout (max. 3 tries
altogether).

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/scsi_scan.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -636,6 +636,18 @@ static int scsi_probe_lun(struct scsi_de
 				    (sshdr.ascq == 0))
 					continue;
 			}
+			/*
+			 * The retry count 3 in scsi_execute_req() above has no
+			 * effect, because the mid layer doesn't retry
+			 * REQ_OP_SCSI commands, relying on callers.
+			 * So retry here.
+			 */
+			if (host_byte(result) == DID_TIME_OUT) {
+				SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
+								 "scsi scan: retry after timeout\n"));
+				continue;
+			}
+
 		} else if (result == 0) {
 			/*
 			 * if nothing was transferred, we try