diff mbox series

[2/2] scsi: scan: retry INQUIRY after timeout

Message ID 20220615164149.3092-3-mwilck@suse.com
State New
Headers show
Series Fixes for device probing on flaky connections | expand

Commit Message

Martin Wilck June 15, 2022, 4:41 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see
scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts
during SCSI device probing, causing device probing to fail. This has been
observed in FCoE uplink failover tests, for example.

This patch fixes the issue by retrying the INQUIRY up to 3 times (in practice,
we never observed more than a single retry),

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

Patch

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b9b851ce1b72..f0a248bd1cd3 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -700,6 +700,11 @@  static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
 						"scsi scan: retry inquiry after REPORT LUNs\n"));
 				continue;
 			}
+			if (host_byte(result) == DID_TIME_OUT) {
+				SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
+						"scsi scan: retry inquiry after timeout\n"));
+				continue;
+			}
 		} else if (result == 0) {
 			/*
 			 * if nothing was transferred, we try