If a scsi host is removed during an asynchronous SCSI scan, the mpt2sas
and mpt3sas .scan_finished callback function may take up to 5 minutes to
timeout and notify the SCSI layer that the operation has failed.  Once the
driver determines that an adapter is gone, stop waiting for the scan to
complete.

Signed-off-by: Joe Lawrence <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: Nagalakshmi Nandigama <[email protected]>
Cc: Sreekanth Reddy <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 10 ++++++++--
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 12 +++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc92..d1e24e7 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7951,14 +7951,20 @@ _scsih_scan_start(struct Scsi_Host *shost)
  * @time: elapsed time of the scan in jiffies
  *
  * This function will be called periodically until it returns 1 with the
- * scsi_host and the elapsed time of the scan in jiffies. In our implemention,
- * we wait for firmware discovery to complete, then return 1.
+ * scsi_host and the elapsed time of the scan in jiffies. In our
+ * implementation, we wait for firmware discovery to complete, then return 1.
  */
 static int
 _scsih_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
        struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
 
+       if (ioc->remove_host) {
+               printk(MPT2SAS_INFO_FMT "port enable: FAILED host removed\n",
+                   ioc->name);
+               return 1;
+       }
+
        if (disable_discovery > 0) {
                ioc->is_driver_loading = 0;
                ioc->wait_for_discovery_to_complete = 0;
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 6421a06..170f485 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7665,15 +7665,21 @@ _scsih_scan_start(struct Scsi_Host *shost)
  * @shost: SCSI host pointer
  * @time: elapsed time of the scan in jiffies
  *
- * This function will be called periodicallyn until it returns 1 with the
- * scsi_host and the elapsed time of the scan in jiffies. In our implemention,
- * we wait for firmware discovery to complete, then return 1.
+ * This function will be called periodically until it returns 1 with the
+ * scsi_host and the elapsed time of the scan in jiffies. In our
+ * implementation, we wait for firmware discovery to complete, then return 1.
  */
 static int
 _scsih_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
        struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
 
+       if (ioc->remove_host) {
+               pr_info(MPT3SAS_FMT "port enable: FAILED host removed\n",
+                       ioc->name);
+               return 1;
+       }
+
        if (disable_discovery > 0) {
                ioc->is_driver_loading = 0;
                ioc->wait_for_discovery_to_complete = 0;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to