scsi: hpsa: wait longer for ptraid commands

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>
This commit is contained in:
Don Brace 2019-05-07 13:32:20 -05:00 committed by Martin K. Petersen
parent 4770e68d16
commit b443d3eab6
1 changed files with 20 additions and 6 deletions

View 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;