aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDon Brace <don.brace@microsemi.com>2016-04-27 18:13:51 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-29 19:08:24 -0400
commitc448ecfa0b2e648a668a1c62286e989ab1dbf6c8 (patch)
tree35b0c523b24d7f9450f459d09c053f98073f27a1 /drivers/scsi
parentded1be4ae6b8e279ab43a5fe2069dd60bb836d30 (diff)
hpsa: add timeouts for driver initiated commands
faulty drives can cause the driver to hang during a scan operation. Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/hpsa.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a677dfe09998..5ef62eafe5d1 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2831,7 +2831,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
2831 goto out; 2831 goto out;
2832 } 2832 }
2833 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 2833 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
2834 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 2834 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
2835 if (rc) 2835 if (rc)
2836 goto out; 2836 goto out;
2837 ei = c->err_info; 2837 ei = c->err_info;
@@ -2857,7 +2857,7 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr,
2857 /* fill_cmd can't fail here, no data buffer to map. */ 2857 /* fill_cmd can't fail here, no data buffer to map. */
2858 (void) fill_cmd(c, reset_type, h, NULL, 0, 0, 2858 (void) fill_cmd(c, reset_type, h, NULL, 0, 0,
2859 scsi3addr, TYPE_MSG); 2859 scsi3addr, TYPE_MSG);
2860 rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); 2860 rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
2861 if (rc) { 2861 if (rc) {
2862 dev_warn(&h->pdev->dev, "Failed to send reset command\n"); 2862 dev_warn(&h->pdev->dev, "Failed to send reset command\n");
2863 goto out; 2863 goto out;
@@ -3105,7 +3105,7 @@ static int hpsa_get_raid_map(struct ctlr_info *h,
3105 return -1; 3105 return -1;
3106 } 3106 }
3107 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 3107 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3108 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 3108 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3109 if (rc) 3109 if (rc)
3110 goto out; 3110 goto out;
3111 ei = c->err_info; 3111 ei = c->err_info;
@@ -3148,7 +3148,7 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h,
3148 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; 3148 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3149 3149
3150 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 3150 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3151 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 3151 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3152 if (rc) 3152 if (rc)
3153 goto out; 3153 goto out;
3154 ei = c->err_info; 3154 ei = c->err_info;
@@ -3176,7 +3176,7 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h,
3176 goto out; 3176 goto out;
3177 3177
3178 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 3178 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3179 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 3179 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3180 if (rc) 3180 if (rc)
3181 goto out; 3181 goto out;
3182 ei = c->err_info; 3182 ei = c->err_info;
@@ -3207,7 +3207,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h,
3207 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff; 3207 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3208 3208
3209 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, 3209 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3210 NO_TIMEOUT); 3210 DEFAULT_TIMEOUT);
3211 ei = c->err_info; 3211 ei = c->err_info;
3212 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) { 3212 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3213 hpsa_scsi_interpret_error(h, c); 3213 hpsa_scsi_interpret_error(h, c);
@@ -3275,7 +3275,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h,
3275 c->Request.CDB[5] = 0; 3275 c->Request.CDB[5] = 0;
3276 3276
3277 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE, 3277 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3278 NO_TIMEOUT); 3278 DEFAULT_TIMEOUT);
3279 if (rc) 3279 if (rc)
3280 goto out; 3280 goto out;
3281 3281
@@ -3487,7 +3487,7 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
3487 if (extended_response) 3487 if (extended_response)
3488 c->Request.CDB[1] = extended_response; 3488 c->Request.CDB[1] = extended_response;
3489 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 3489 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3490 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 3490 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3491 if (rc) 3491 if (rc)
3492 goto out; 3492 goto out;
3493 ei = c->err_info; 3493 ei = c->err_info;
@@ -3594,7 +3594,8 @@ static int hpsa_volume_offline(struct ctlr_info *h,
3594 c = cmd_alloc(h); 3594 c = cmd_alloc(h);
3595 3595
3596 (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD); 3596 (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD);
3597 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); 3597 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
3598 DEFAULT_TIMEOUT);
3598 if (rc) { 3599 if (rc) {
3599 cmd_free(h, c); 3600 cmd_free(h, c);
3600 return 0; 3601 return 0;
@@ -3669,7 +3670,8 @@ static int hpsa_device_supports_aborts(struct ctlr_info *h,
3669 c = cmd_alloc(h); 3670 c = cmd_alloc(h);
3670 3671
3671 (void) fill_cmd(c, HPSA_ABORT_MSG, h, &tag, 0, 0, scsi3addr, TYPE_MSG); 3672 (void) fill_cmd(c, HPSA_ABORT_MSG, h, &tag, 0, 0, scsi3addr, TYPE_MSG);
3672 (void) hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); 3673 (void) hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
3674 DEFAULT_TIMEOUT);
3673 /* no unmap needed here because no data xfer. */ 3675 /* no unmap needed here because no data xfer. */
3674 ei = c->err_info; 3676 ei = c->err_info;
3675 switch (ei->CommandStatus) { 3677 switch (ei->CommandStatus) {
@@ -5439,7 +5441,7 @@ static int hpsa_send_test_unit_ready(struct ctlr_info *h,
5439 /* Send the Test Unit Ready, fill_cmd can't fail, no mapping */ 5441 /* Send the Test Unit Ready, fill_cmd can't fail, no mapping */
5440 (void) fill_cmd(c, TEST_UNIT_READY, h, 5442 (void) fill_cmd(c, TEST_UNIT_READY, h,
5441 NULL, 0, 0, lunaddr, TYPE_CMD); 5443 NULL, 0, 0, lunaddr, TYPE_CMD);
5442 rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); 5444 rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
5443 if (rc) 5445 if (rc)
5444 return rc; 5446 return rc;
5445 /* no unmap needed here because no data xfer. */ 5447 /* no unmap needed here because no data xfer. */
@@ -5663,7 +5665,7 @@ static int hpsa_send_abort(struct ctlr_info *h, unsigned char *scsi3addr,
5663 0, 0, scsi3addr, TYPE_MSG); 5665 0, 0, scsi3addr, TYPE_MSG);
5664 if (h->needs_abort_tags_swizzled) 5666 if (h->needs_abort_tags_swizzled)
5665 swizzle_abort_tag(&c->Request.CDB[4]); 5667 swizzle_abort_tag(&c->Request.CDB[4]);
5666 (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); 5668 (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
5667 hpsa_get_tag(h, abort, &taglower, &tagupper); 5669 hpsa_get_tag(h, abort, &taglower, &tagupper);
5668 dev_dbg(&h->pdev->dev, "%s: Tag:0x%08x:%08x: do_simple_cmd(abort) completed.\n", 5670 dev_dbg(&h->pdev->dev, "%s: Tag:0x%08x:%08x: do_simple_cmd(abort) completed.\n",
5669 __func__, tagupper, taglower); 5671 __func__, tagupper, taglower);
@@ -5828,7 +5830,7 @@ static int hpsa_send_abort_ioaccel2(struct ctlr_info *h,
5828 c = cmd_alloc(h); 5830 c = cmd_alloc(h);
5829 setup_ioaccel2_abort_cmd(c, h, abort, reply_queue); 5831 setup_ioaccel2_abort_cmd(c, h, abort, reply_queue);
5830 c2 = &h->ioaccel2_cmd_pool[c->cmdindex]; 5832 c2 = &h->ioaccel2_cmd_pool[c->cmdindex];
5831 (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); 5833 (void) hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT);
5832 hpsa_get_tag(h, abort, &taglower, &tagupper); 5834 hpsa_get_tag(h, abort, &taglower, &tagupper);
5833 dev_dbg(&h->pdev->dev, 5835 dev_dbg(&h->pdev->dev,
5834 "%s: Tag:0x%08x:%08x: do_simple_cmd(ioaccel2 abort) completed.\n", 5836 "%s: Tag:0x%08x:%08x: do_simple_cmd(ioaccel2 abort) completed.\n",
@@ -6373,7 +6375,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
6373 c->SG[0].Len = cpu_to_le32(iocommand.buf_size); 6375 c->SG[0].Len = cpu_to_le32(iocommand.buf_size);
6374 c->SG[0].Ext = cpu_to_le32(HPSA_SG_LAST); /* not chaining */ 6376 c->SG[0].Ext = cpu_to_le32(HPSA_SG_LAST); /* not chaining */
6375 } 6377 }
6376 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); 6378 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
6379 DEFAULT_TIMEOUT);
6377 if (iocommand.buf_size > 0) 6380 if (iocommand.buf_size > 0)
6378 hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL); 6381 hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
6379 check_ioctl_unit_attention(h, c); 6382 check_ioctl_unit_attention(h, c);
@@ -6505,7 +6508,8 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
6505 } 6508 }
6506 c->SG[--i].Ext = cpu_to_le32(HPSA_SG_LAST); 6509 c->SG[--i].Ext = cpu_to_le32(HPSA_SG_LAST);
6507 } 6510 }
6508 status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); 6511 status = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
6512 DEFAULT_TIMEOUT);
6509 if (sg_used) 6513 if (sg_used)
6510 hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL); 6514 hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
6511 check_ioctl_unit_attention(h, c); 6515 check_ioctl_unit_attention(h, c);
@@ -8728,7 +8732,7 @@ static void hpsa_flush_cache(struct ctlr_info *h)
8728 goto out; 8732 goto out;
8729 } 8733 }
8730 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8734 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8731 PCI_DMA_TODEVICE, NO_TIMEOUT); 8735 PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
8732 if (rc) 8736 if (rc)
8733 goto out; 8737 goto out;
8734 if (c->err_info->CommandStatus != 0) 8738 if (c->err_info->CommandStatus != 0)
@@ -8767,7 +8771,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
8767 goto errout; 8771 goto errout;
8768 8772
8769 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8773 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8770 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 8774 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
8771 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8775 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8772 goto errout; 8776 goto errout;
8773 8777
@@ -8779,7 +8783,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
8779 goto errout; 8783 goto errout;
8780 8784
8781 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8785 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8782 PCI_DMA_TODEVICE, NO_TIMEOUT); 8786 PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
8783 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8787 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8784 goto errout; 8788 goto errout;
8785 8789
@@ -8789,7 +8793,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
8789 goto errout; 8793 goto errout;
8790 8794
8791 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, 8795 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8792 PCI_DMA_FROMDEVICE, NO_TIMEOUT); 8796 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
8793 if ((rc != 0) || (c->err_info->CommandStatus != 0)) 8797 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8794 goto errout; 8798 goto errout;
8795 8799