scsi: hpsa: wait longer for ptraid commands
authorDon Brace <don.brace@microsemi.com>
Tue, 7 May 2019 18:32:20 +0000 (13:32 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 18 Jun 2019 23:46:18 +0000 (19:46 -0400)
Wait longer for outstanding commands before removing a multipath
device. Increase the timeout value for ptraid commands.

Reviewed-by: Justin Lindley <justin.lindley@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hpsa.c

index 283fd603624b743648680e534417bec2031e62a6..df447f1d63119caea767253fe766f9d16d93eabe 100644 (file)
@@ -73,6 +73,8 @@
 
 /*define how many times we will try a command because of bus resets */
 #define MAX_CMD_RETRIES 3
+/* How long to wait before giving up on a command */
+#define HPSA_EH_PTRAID_TIMEOUT (240 * HZ)
 
 /* Embedded module documentation macros - see modules.h */
 MODULE_AUTHOR("Hewlett-Packard Company");
@@ -1842,25 +1844,33 @@ static int hpsa_find_outstanding_commands_for_dev(struct ctlr_info *h,
        return count;
 }
 
+#define NUM_WAIT 20
 static void hpsa_wait_for_outstanding_commands_for_dev(struct ctlr_info *h,
                                                struct hpsa_scsi_dev_t *device)
 {
        int cmds = 0;
        int waits = 0;
+       int num_wait = NUM_WAIT;
+
+       if (device->external)
+               num_wait = HPSA_EH_PTRAID_TIMEOUT;
 
        while (1) {
                cmds = hpsa_find_outstanding_commands_for_dev(h, device);
                if (cmds == 0)
                        break;
-               if (++waits > 20)
+               if (++waits > num_wait)
                        break;
                msleep(1000);
        }
 
-       if (waits > 20)
+       if (waits > num_wait) {
                dev_warn(&h->pdev->dev,
-                       "%s: removing device with %d outstanding commands!\n",
-                       __func__, cmds);
+                       "%s: removing device [%d:%d:%d:%d] with %d outstanding commands!\n",
+                       __func__,
+                       h->scsi_host->host_no,
+                       device->bus, device->target, device->lun, cmds);
+       }
 }
 
 static void hpsa_remove_device(struct ctlr_info *h,
@@ -2131,11 +2141,15 @@ static int hpsa_slave_configure(struct scsi_device *sdev)
        sdev->no_uld_attach = !sd || !sd->expose_device;
 
        if (sd) {
-               if (sd->external)
+               if (sd->external) {
                        queue_depth = EXTERNAL_QD;
-               else
+                       sdev->eh_timeout = HPSA_EH_PTRAID_TIMEOUT;
+                       blk_queue_rq_timeout(sdev->request_queue,
+                                               HPSA_EH_PTRAID_TIMEOUT);
+               } else {
                        queue_depth = sd->queue_depth != 0 ?
                                        sd->queue_depth : sdev->host->can_queue;
+               }
        } else
                queue_depth = sdev->host->can_queue;