diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-24 19:08:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-24 19:08:51 -0500 |
commit | 16bca1d572930e5b91714d2c79ec986bc819e7a6 (patch) | |
tree | 08f11baf62bc5c13d0a9202c926f8c4e18de6441 /drivers/scsi | |
parent | e98092bedcfff1908ad7a32acc46f13e4d8b2f43 (diff) | |
parent | 3569e5374df66a42ab66368b8bbb075e81d4e85c (diff) |
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
SCSI fixes on 20120224:
"This is a set of assorted bug fixes for power management, mpt2sas,
ipr, the rdac device handler and quite a big chunk for qla2xxx (plus a
use after free of scsi_host in scsi_scan.c). "
* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] scsi_dh_rdac: Fix for unbalanced reference count
[SCSI] scsi_pm: Fix bug in the SCSI power management handler
[SCSI] scsi_scan: Fix 'Poison overwritten' warning caused by using freed 'shost'
[SCSI] qla2xxx: Update version number to 8.03.07.13-k.
[SCSI] qla2xxx: Proper detection of firmware abort error code for ISP82xx.
[SCSI] qla2xxx: Remove resetting memory during device initialization for ISP82xx.
[SCSI] qla2xxx: Complete mailbox command timedout to avoid initialization failures during next reset cycle.
[SCSI] qla2xxx: Remove check for null fcport from host reset handler.
[SCSI] qla2xxx: Correct out of bounds read of ISP2200 mailbox registers.
[SCSI] qla2xxx: Remove errant clearing of MBX_INTERRUPT flag during CT-IOCB processing.
[SCSI] qla2xxx: Clear options-flags while issuing stop-firmware mbx command.
[SCSI] qla2xxx: Add an "is reset active" helper.
[SCSI] qla2xxx: Add check for null fcport references in qla2xxx_queuecommand.
[SCSI] qla2xxx: Propagate up abort failures.
[SCSI] isci: Fix NULL ptr dereference when no firmware is being loaded
[SCSI] ipr: fix eeh recovery for 64-bit adapters
[SCSI] mpt2sas: Fix mismatch in mpt2sas_base_hard_reset_handler() mutex lock-unlock
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_rdac.c | 25 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 24 | ||||
-rw-r--r-- | drivers/scsi/isci/host.c | 4 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 13 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_bsg.c | 50 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 3 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_inline.h | 13 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_isr.c | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 7 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_nx.c | 15 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 19 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_version.h | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_pm.c | 16 | ||||
-rw-r--r-- | drivers/scsi/scsi_priv.h | 1 | ||||
-rw-r--r-- | drivers/scsi/scsi_scan.c | 4 |
17 files changed, 101 insertions, 100 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 53a31c753cb1..20c4557f5abd 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c | |||
@@ -364,10 +364,7 @@ static void release_controller(struct kref *kref) | |||
364 | struct rdac_controller *ctlr; | 364 | struct rdac_controller *ctlr; |
365 | ctlr = container_of(kref, struct rdac_controller, kref); | 365 | ctlr = container_of(kref, struct rdac_controller, kref); |
366 | 366 | ||
367 | flush_workqueue(kmpath_rdacd); | ||
368 | spin_lock(&list_lock); | ||
369 | list_del(&ctlr->node); | 367 | list_del(&ctlr->node); |
370 | spin_unlock(&list_lock); | ||
371 | kfree(ctlr); | 368 | kfree(ctlr); |
372 | } | 369 | } |
373 | 370 | ||
@@ -376,20 +373,17 @@ static struct rdac_controller *get_controller(int index, char *array_name, | |||
376 | { | 373 | { |
377 | struct rdac_controller *ctlr, *tmp; | 374 | struct rdac_controller *ctlr, *tmp; |
378 | 375 | ||
379 | spin_lock(&list_lock); | ||
380 | |||
381 | list_for_each_entry(tmp, &ctlr_list, node) { | 376 | list_for_each_entry(tmp, &ctlr_list, node) { |
382 | if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) && | 377 | if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) && |
383 | (tmp->index == index) && | 378 | (tmp->index == index) && |
384 | (tmp->host == sdev->host)) { | 379 | (tmp->host == sdev->host)) { |
385 | kref_get(&tmp->kref); | 380 | kref_get(&tmp->kref); |
386 | spin_unlock(&list_lock); | ||
387 | return tmp; | 381 | return tmp; |
388 | } | 382 | } |
389 | } | 383 | } |
390 | ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC); | 384 | ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC); |
391 | if (!ctlr) | 385 | if (!ctlr) |
392 | goto done; | 386 | return NULL; |
393 | 387 | ||
394 | /* initialize fields of controller */ | 388 | /* initialize fields of controller */ |
395 | memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN); | 389 | memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN); |
@@ -405,8 +399,7 @@ static struct rdac_controller *get_controller(int index, char *array_name, | |||
405 | INIT_WORK(&ctlr->ms_work, send_mode_select); | 399 | INIT_WORK(&ctlr->ms_work, send_mode_select); |
406 | INIT_LIST_HEAD(&ctlr->ms_head); | 400 | INIT_LIST_HEAD(&ctlr->ms_head); |
407 | list_add(&ctlr->node, &ctlr_list); | 401 | list_add(&ctlr->node, &ctlr_list); |
408 | done: | 402 | |
409 | spin_unlock(&list_lock); | ||
410 | return ctlr; | 403 | return ctlr; |
411 | } | 404 | } |
412 | 405 | ||
@@ -517,9 +510,12 @@ static int initialize_controller(struct scsi_device *sdev, | |||
517 | index = 0; | 510 | index = 0; |
518 | else | 511 | else |
519 | index = 1; | 512 | index = 1; |
513 | |||
514 | spin_lock(&list_lock); | ||
520 | h->ctlr = get_controller(index, array_name, array_id, sdev); | 515 | h->ctlr = get_controller(index, array_name, array_id, sdev); |
521 | if (!h->ctlr) | 516 | if (!h->ctlr) |
522 | err = SCSI_DH_RES_TEMP_UNAVAIL; | 517 | err = SCSI_DH_RES_TEMP_UNAVAIL; |
518 | spin_unlock(&list_lock); | ||
523 | } | 519 | } |
524 | return err; | 520 | return err; |
525 | } | 521 | } |
@@ -906,7 +902,9 @@ static int rdac_bus_attach(struct scsi_device *sdev) | |||
906 | return 0; | 902 | return 0; |
907 | 903 | ||
908 | clean_ctlr: | 904 | clean_ctlr: |
905 | spin_lock(&list_lock); | ||
909 | kref_put(&h->ctlr->kref, release_controller); | 906 | kref_put(&h->ctlr->kref, release_controller); |
907 | spin_unlock(&list_lock); | ||
910 | 908 | ||
911 | failed: | 909 | failed: |
912 | kfree(scsi_dh_data); | 910 | kfree(scsi_dh_data); |
@@ -921,14 +919,19 @@ static void rdac_bus_detach( struct scsi_device *sdev ) | |||
921 | struct rdac_dh_data *h; | 919 | struct rdac_dh_data *h; |
922 | unsigned long flags; | 920 | unsigned long flags; |
923 | 921 | ||
924 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | ||
925 | scsi_dh_data = sdev->scsi_dh_data; | 922 | scsi_dh_data = sdev->scsi_dh_data; |
923 | h = (struct rdac_dh_data *) scsi_dh_data->buf; | ||
924 | if (h->ctlr && h->ctlr->ms_queued) | ||
925 | flush_workqueue(kmpath_rdacd); | ||
926 | |||
927 | spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | ||
926 | sdev->scsi_dh_data = NULL; | 928 | sdev->scsi_dh_data = NULL; |
927 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); | 929 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); |
928 | 930 | ||
929 | h = (struct rdac_dh_data *) scsi_dh_data->buf; | 931 | spin_lock(&list_lock); |
930 | if (h->ctlr) | 932 | if (h->ctlr) |
931 | kref_put(&h->ctlr->kref, release_controller); | 933 | kref_put(&h->ctlr->kref, release_controller); |
934 | spin_unlock(&list_lock); | ||
932 | kfree(scsi_dh_data); | 935 | kfree(scsi_dh_data); |
933 | module_put(THIS_MODULE); | 936 | module_put(THIS_MODULE); |
934 | sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME); | 937 | sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 67b169b7a5be..b538f0883fd2 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4613,11 +4613,13 @@ static int __ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd) | |||
4613 | ENTER; | 4613 | ENTER; |
4614 | ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; | 4614 | ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; |
4615 | 4615 | ||
4616 | dev_err(&ioa_cfg->pdev->dev, | 4616 | if (!ioa_cfg->in_reset_reload) { |
4617 | "Adapter being reset as a result of error recovery.\n"); | 4617 | dev_err(&ioa_cfg->pdev->dev, |
4618 | "Adapter being reset as a result of error recovery.\n"); | ||
4618 | 4619 | ||
4619 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | 4620 | if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) |
4620 | ioa_cfg->sdt_state = GET_DUMP; | 4621 | ioa_cfg->sdt_state = GET_DUMP; |
4622 | } | ||
4621 | 4623 | ||
4622 | rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV); | 4624 | rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV); |
4623 | 4625 | ||
@@ -4907,7 +4909,7 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd) | |||
4907 | struct ipr_ioa_cfg *ioa_cfg; | 4909 | struct ipr_ioa_cfg *ioa_cfg; |
4908 | struct ipr_resource_entry *res; | 4910 | struct ipr_resource_entry *res; |
4909 | struct ipr_cmd_pkt *cmd_pkt; | 4911 | struct ipr_cmd_pkt *cmd_pkt; |
4910 | u32 ioasc; | 4912 | u32 ioasc, int_reg; |
4911 | int op_found = 0; | 4913 | int op_found = 0; |
4912 | 4914 | ||
4913 | ENTER; | 4915 | ENTER; |
@@ -4920,7 +4922,17 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd) | |||
4920 | */ | 4922 | */ |
4921 | if (ioa_cfg->in_reset_reload || ioa_cfg->ioa_is_dead) | 4923 | if (ioa_cfg->in_reset_reload || ioa_cfg->ioa_is_dead) |
4922 | return FAILED; | 4924 | return FAILED; |
4923 | if (!res || !ipr_is_gscsi(res)) | 4925 | if (!res) |
4926 | return FAILED; | ||
4927 | |||
4928 | /* | ||
4929 | * If we are aborting a timed out op, chances are that the timeout was caused | ||
4930 | * by a still not detected EEH error. In such cases, reading a register will | ||
4931 | * trigger the EEH recovery infrastructure. | ||
4932 | */ | ||
4933 | int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); | ||
4934 | |||
4935 | if (!ipr_is_gscsi(res)) | ||
4924 | return FAILED; | 4936 | return FAILED; |
4925 | 4937 | ||
4926 | list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { | 4938 | list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { |
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 1a65d6514237..418391b1c361 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -1848,9 +1848,11 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost) | |||
1848 | if (state == SCIC_RESET || | 1848 | if (state == SCIC_RESET || |
1849 | state == SCIC_INITIALIZING || | 1849 | state == SCIC_INITIALIZING || |
1850 | state == SCIC_INITIALIZED) { | 1850 | state == SCIC_INITIALIZED) { |
1851 | u8 oem_version = pci_info->orom ? pci_info->orom->hdr.version : | ||
1852 | ISCI_ROM_VER_1_0; | ||
1851 | 1853 | ||
1852 | if (sci_oem_parameters_validate(&ihost->oem_parameters, | 1854 | if (sci_oem_parameters_validate(&ihost->oem_parameters, |
1853 | pci_info->orom->hdr.version)) | 1855 | oem_version)) |
1854 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; | 1856 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; |
1855 | 1857 | ||
1856 | return SCI_SUCCESS; | 1858 | return SCI_SUCCESS; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 0b2c95583660..a78036f5e1a6 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -4548,7 +4548,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
4548 | printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n", | 4548 | printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n", |
4549 | ioc->name, __func__); | 4549 | ioc->name, __func__); |
4550 | r = 0; | 4550 | r = 0; |
4551 | goto out; | 4551 | goto out_unlocked; |
4552 | } | 4552 | } |
4553 | 4553 | ||
4554 | if (mpt2sas_fwfault_debug) | 4554 | if (mpt2sas_fwfault_debug) |
@@ -4604,6 +4604,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
4604 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | 4604 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); |
4605 | mutex_unlock(&ioc->reset_in_progress_mutex); | 4605 | mutex_unlock(&ioc->reset_in_progress_mutex); |
4606 | 4606 | ||
4607 | out_unlocked: | ||
4607 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: exit\n", ioc->name, | 4608 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: exit\n", ioc->name, |
4608 | __func__)); | 4609 | __func__)); |
4609 | return r; | 4610 | return r; |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index a2f1b3043dfb..9f41b3b4358f 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1036,8 +1036,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, | |||
1036 | vha->device_flags & DFLG_NO_CABLE) | 1036 | vha->device_flags & DFLG_NO_CABLE) |
1037 | len = snprintf(buf, PAGE_SIZE, "Link Down\n"); | 1037 | len = snprintf(buf, PAGE_SIZE, "Link Down\n"); |
1038 | else if (atomic_read(&vha->loop_state) != LOOP_READY || | 1038 | else if (atomic_read(&vha->loop_state) != LOOP_READY || |
1039 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1039 | qla2x00_reset_active(vha)) |
1040 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1041 | len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); | 1040 | len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); |
1042 | else { | 1041 | else { |
1043 | len = snprintf(buf, PAGE_SIZE, "Link Up - "); | 1042 | len = snprintf(buf, PAGE_SIZE, "Link Up - "); |
@@ -1359,8 +1358,7 @@ qla2x00_thermal_temp_show(struct device *dev, | |||
1359 | return snprintf(buf, PAGE_SIZE, "\n"); | 1358 | return snprintf(buf, PAGE_SIZE, "\n"); |
1360 | 1359 | ||
1361 | temp = frac = 0; | 1360 | temp = frac = 0; |
1362 | if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1361 | if (qla2x00_reset_active(vha)) |
1363 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1364 | ql_log(ql_log_warn, vha, 0x707b, | 1362 | ql_log(ql_log_warn, vha, 0x707b, |
1365 | "ISP reset active.\n"); | 1363 | "ISP reset active.\n"); |
1366 | else if (!vha->hw->flags.eeh_busy) | 1364 | else if (!vha->hw->flags.eeh_busy) |
@@ -1379,8 +1377,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, | |||
1379 | int rval = QLA_FUNCTION_FAILED; | 1377 | int rval = QLA_FUNCTION_FAILED; |
1380 | uint16_t state[5]; | 1378 | uint16_t state[5]; |
1381 | 1379 | ||
1382 | if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | 1380 | if (qla2x00_reset_active(vha)) |
1383 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | ||
1384 | ql_log(ql_log_warn, vha, 0x707c, | 1381 | ql_log(ql_log_warn, vha, 0x707c, |
1385 | "ISP reset active.\n"); | 1382 | "ISP reset active.\n"); |
1386 | else if (!vha->hw->flags.eeh_busy) | 1383 | else if (!vha->hw->flags.eeh_busy) |
@@ -1693,9 +1690,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
1693 | if (IS_FWI2_CAPABLE(ha)) { | 1690 | if (IS_FWI2_CAPABLE(ha)) { |
1694 | rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); | 1691 | rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); |
1695 | } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && | 1692 | } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && |
1696 | !test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) && | 1693 | !qla2x00_reset_active(vha) && !ha->dpc_active) { |
1697 | !test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && | ||
1698 | !ha->dpc_active) { | ||
1699 | /* Must be in a 'READY' state for statistics retrieval. */ | 1694 | /* Must be in a 'READY' state for statistics retrieval. */ |
1700 | rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, | 1695 | rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, |
1701 | stats, stats_dma); | 1696 | stats, stats_dma); |
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index b1d0f936bf2d..1682e2e4201d 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
@@ -108,13 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) | |||
108 | goto exit_fcp_prio_cfg; | 108 | goto exit_fcp_prio_cfg; |
109 | } | 109 | } |
110 | 110 | ||
111 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
112 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
113 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
114 | ret = -EBUSY; | ||
115 | goto exit_fcp_prio_cfg; | ||
116 | } | ||
117 | |||
118 | /* Get the sub command */ | 111 | /* Get the sub command */ |
119 | oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; | 112 | oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; |
120 | 113 | ||
@@ -646,13 +639,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) | |||
646 | dma_addr_t rsp_data_dma; | 639 | dma_addr_t rsp_data_dma; |
647 | uint32_t rsp_data_len; | 640 | uint32_t rsp_data_len; |
648 | 641 | ||
649 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
650 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
651 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
652 | ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n"); | ||
653 | return -EBUSY; | ||
654 | } | ||
655 | |||
656 | if (!vha->flags.online) { | 642 | if (!vha->flags.online) { |
657 | ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); | 643 | ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); |
658 | return -EIO; | 644 | return -EIO; |
@@ -874,13 +860,6 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) | |||
874 | int rval = 0; | 860 | int rval = 0; |
875 | uint32_t flag; | 861 | uint32_t flag; |
876 | 862 | ||
877 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
878 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
879 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
880 | ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n"); | ||
881 | return -EBUSY; | ||
882 | } | ||
883 | |||
884 | if (!IS_QLA84XX(ha)) { | 863 | if (!IS_QLA84XX(ha)) { |
885 | ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); | 864 | ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); |
886 | return -EINVAL; | 865 | return -EINVAL; |
@@ -922,11 +901,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) | |||
922 | uint32_t flag; | 901 | uint32_t flag; |
923 | uint32_t fw_ver; | 902 | uint32_t fw_ver; |
924 | 903 | ||
925 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
926 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
927 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) | ||
928 | return -EBUSY; | ||
929 | |||
930 | if (!IS_QLA84XX(ha)) { | 904 | if (!IS_QLA84XX(ha)) { |
931 | ql_dbg(ql_dbg_user, vha, 0x7032, | 905 | ql_dbg(ql_dbg_user, vha, 0x7032, |
932 | "Not 84xx, exiting.\n"); | 906 | "Not 84xx, exiting.\n"); |
@@ -1036,14 +1010,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) | |||
1036 | uint32_t data_len = 0; | 1010 | uint32_t data_len = 0; |
1037 | uint32_t dma_direction = DMA_NONE; | 1011 | uint32_t dma_direction = DMA_NONE; |
1038 | 1012 | ||
1039 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
1040 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
1041 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
1042 | ql_log(ql_log_warn, vha, 0x7039, | ||
1043 | "Abort active or needed.\n"); | ||
1044 | return -EBUSY; | ||
1045 | } | ||
1046 | |||
1047 | if (!IS_QLA84XX(ha)) { | 1013 | if (!IS_QLA84XX(ha)) { |
1048 | ql_log(ql_log_warn, vha, 0x703a, | 1014 | ql_log(ql_log_warn, vha, 0x703a, |
1049 | "Not 84xx, exiting.\n"); | 1015 | "Not 84xx, exiting.\n"); |
@@ -1246,13 +1212,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) | |||
1246 | 1212 | ||
1247 | bsg_job->reply->reply_payload_rcv_len = 0; | 1213 | bsg_job->reply->reply_payload_rcv_len = 0; |
1248 | 1214 | ||
1249 | if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
1250 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | ||
1251 | test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | ||
1252 | ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n"); | ||
1253 | return -EBUSY; | ||
1254 | } | ||
1255 | |||
1256 | if (!IS_IIDMA_CAPABLE(vha->hw)) { | 1215 | if (!IS_IIDMA_CAPABLE(vha->hw)) { |
1257 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); | 1216 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); |
1258 | return -EINVAL; | 1217 | return -EINVAL; |
@@ -1668,6 +1627,15 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) | |||
1668 | vha = shost_priv(host); | 1627 | vha = shost_priv(host); |
1669 | } | 1628 | } |
1670 | 1629 | ||
1630 | if (qla2x00_reset_active(vha)) { | ||
1631 | ql_dbg(ql_dbg_user, vha, 0x709f, | ||
1632 | "BSG: ISP abort active/needed -- cmd=%d.\n", | ||
1633 | bsg_job->request->msgcode); | ||
1634 | bsg_job->reply->result = (DID_ERROR << 16); | ||
1635 | bsg_job->job_done(bsg_job); | ||
1636 | return -EBUSY; | ||
1637 | } | ||
1638 | |||
1671 | ql_dbg(ql_dbg_user, vha, 0x7000, | 1639 | ql_dbg(ql_dbg_user, vha, 0x7000, |
1672 | "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); | 1640 | "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); |
1673 | 1641 | ||
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 7c54624b5b13..45cbf0ba624d 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -19,7 +19,8 @@ | |||
19 | * | DPC Thread | 0x401c | | | 19 | * | DPC Thread | 0x401c | | |
20 | * | Async Events | 0x5057 | 0x5052 | | 20 | * | Async Events | 0x5057 | 0x5052 | |
21 | * | Timer Routines | 0x6011 | 0x600e,0x600f | | 21 | * | Timer Routines | 0x6011 | 0x600e,0x600f | |
22 | * | User Space Interactions | 0x709e | | | 22 | * | User Space Interactions | 0x709e | 0x7018,0x702e | |
23 | * | | | 0x7039,0x7045 | | ||
23 | * | Task Management | 0x803c | 0x8025-0x8026 | | 24 | * | Task Management | 0x803c | 0x8025-0x8026 | |
24 | * | | | 0x800b,0x8039 | | 25 | * | | | 0x800b,0x8039 | |
25 | * | AER/EEH | 0x900f | | | 26 | * | AER/EEH | 0x900f | | |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a6a4eebce4a8..af1003f9de1e 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -44,6 +44,7 @@ | |||
44 | * ISP2100 HBAs. | 44 | * ISP2100 HBAs. |
45 | */ | 45 | */ |
46 | #define MAILBOX_REGISTER_COUNT_2100 8 | 46 | #define MAILBOX_REGISTER_COUNT_2100 8 |
47 | #define MAILBOX_REGISTER_COUNT_2200 24 | ||
47 | #define MAILBOX_REGISTER_COUNT 32 | 48 | #define MAILBOX_REGISTER_COUNT 32 |
48 | 49 | ||
49 | #define QLA2200A_RISC_ROM_VER 4 | 50 | #define QLA2200A_RISC_ROM_VER 4 |
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 9902834e0b74..7cc4f36cd539 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h | |||
@@ -131,3 +131,16 @@ qla2x00_hba_err_chk_enabled(srb_t *sp) | |||
131 | } | 131 | } |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | |||
135 | static inline int | ||
136 | qla2x00_reset_active(scsi_qla_host_t *vha) | ||
137 | { | ||
138 | scsi_qla_host_t *base_vha = pci_get_drvdata(vha->hw->pdev); | ||
139 | |||
140 | /* Test appropriate base-vha and vha flags. */ | ||
141 | return test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) || | ||
142 | test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || | ||
143 | test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || | ||
144 | test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | ||
145 | test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); | ||
146 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index e804585cc59c..349843ea32f6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -2090,7 +2090,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, | |||
2090 | break; | 2090 | break; |
2091 | case CT_IOCB_TYPE: | 2091 | case CT_IOCB_TYPE: |
2092 | qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); | 2092 | qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); |
2093 | clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags); | ||
2094 | break; | 2093 | break; |
2095 | case ELS_IOCB_TYPE: | 2094 | case ELS_IOCB_TYPE: |
2096 | qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE); | 2095 | qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE); |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 34344d3f8658..08f1d01bdc1c 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -342,6 +342,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
342 | 342 | ||
343 | set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); | 343 | set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); |
344 | clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | 344 | clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
345 | /* Allow next mbx cmd to come in. */ | ||
346 | complete(&ha->mbx_cmd_comp); | ||
345 | if (ha->isp_ops->abort_isp(vha)) { | 347 | if (ha->isp_ops->abort_isp(vha)) { |
346 | /* Failed. retry later. */ | 348 | /* Failed. retry later. */ |
347 | set_bit(ISP_ABORT_NEEDED, | 349 | set_bit(ISP_ABORT_NEEDED, |
@@ -350,6 +352,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
350 | clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); | 352 | clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); |
351 | ql_dbg(ql_dbg_mbx, base_vha, 0x101f, | 353 | ql_dbg(ql_dbg_mbx, base_vha, 0x101f, |
352 | "Finished abort_isp.\n"); | 354 | "Finished abort_isp.\n"); |
355 | goto mbx_done; | ||
353 | } | 356 | } |
354 | } | 357 | } |
355 | } | 358 | } |
@@ -358,6 +361,7 @@ premature_exit: | |||
358 | /* Allow next mbx cmd to come in. */ | 361 | /* Allow next mbx cmd to come in. */ |
359 | complete(&ha->mbx_cmd_comp); | 362 | complete(&ha->mbx_cmd_comp); |
360 | 363 | ||
364 | mbx_done: | ||
361 | if (rval) { | 365 | if (rval) { |
362 | ql_dbg(ql_dbg_mbx, base_vha, 0x1020, | 366 | ql_dbg(ql_dbg_mbx, base_vha, 0x1020, |
363 | "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n", | 367 | "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n", |
@@ -2581,7 +2585,8 @@ qla2x00_stop_firmware(scsi_qla_host_t *vha) | |||
2581 | ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__); | 2585 | ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__); |
2582 | 2586 | ||
2583 | mcp->mb[0] = MBC_STOP_FIRMWARE; | 2587 | mcp->mb[0] = MBC_STOP_FIRMWARE; |
2584 | mcp->out_mb = MBX_0; | 2588 | mcp->mb[1] = 0; |
2589 | mcp->out_mb = MBX_1|MBX_0; | ||
2585 | mcp->in_mb = MBX_0; | 2590 | mcp->in_mb = MBX_0; |
2586 | mcp->tov = 5; | 2591 | mcp->tov = 5; |
2587 | mcp->flags = 0; | 2592 | mcp->flags = 0; |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 1cd46cd7ff90..270ba3130fde 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
@@ -1165,19 +1165,6 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) | |||
1165 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff); | 1165 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff); |
1166 | else | 1166 | else |
1167 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff); | 1167 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff); |
1168 | |||
1169 | /* reset ms */ | ||
1170 | val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4); | ||
1171 | val |= (1 << 1); | ||
1172 | qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); | ||
1173 | msleep(20); | ||
1174 | |||
1175 | /* unreset ms */ | ||
1176 | val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4); | ||
1177 | val &= ~(1 << 1); | ||
1178 | qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); | ||
1179 | msleep(20); | ||
1180 | |||
1181 | qla82xx_rom_unlock(ha); | 1168 | qla82xx_rom_unlock(ha); |
1182 | 1169 | ||
1183 | /* Read the signature value from the flash. | 1170 | /* Read the signature value from the flash. |
@@ -3392,7 +3379,7 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
3392 | QLA82XX_CRB_PEG_NET_3 + 0x3c), | 3379 | QLA82XX_CRB_PEG_NET_3 + 0x3c), |
3393 | qla82xx_rd_32(ha, | 3380 | qla82xx_rd_32(ha, |
3394 | QLA82XX_CRB_PEG_NET_4 + 0x3c)); | 3381 | QLA82XX_CRB_PEG_NET_4 + 0x3c)); |
3395 | if (LSW(MSB(halt_status)) == 0x67) | 3382 | if (((halt_status & 0x1fffff00) >> 8) == 0x67) |
3396 | ql_log(ql_log_warn, vha, 0xb052, | 3383 | ql_log(ql_log_warn, vha, 0xb052, |
3397 | "Firmware aborted with " | 3384 | "Firmware aborted with " |
3398 | "error code 0x00006700. Device is " | 3385 | "error code 0x00006700. Device is " |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 4ed1e4a96b95..036030c95339 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -625,6 +625,12 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) | |||
625 | cmd->result = DID_NO_CONNECT << 16; | 625 | cmd->result = DID_NO_CONNECT << 16; |
626 | goto qc24_fail_command; | 626 | goto qc24_fail_command; |
627 | } | 627 | } |
628 | |||
629 | if (!fcport) { | ||
630 | cmd->result = DID_NO_CONNECT << 16; | ||
631 | goto qc24_fail_command; | ||
632 | } | ||
633 | |||
628 | if (atomic_read(&fcport->state) != FCS_ONLINE) { | 634 | if (atomic_read(&fcport->state) != FCS_ONLINE) { |
629 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || | 635 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || |
630 | atomic_read(&base_vha->loop_state) == LOOP_DEAD) { | 636 | atomic_read(&base_vha->loop_state) == LOOP_DEAD) { |
@@ -877,6 +883,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
877 | 883 | ||
878 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 884 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
879 | if (ha->isp_ops->abort_command(sp)) { | 885 | if (ha->isp_ops->abort_command(sp)) { |
886 | ret = FAILED; | ||
880 | ql_dbg(ql_dbg_taskm, vha, 0x8003, | 887 | ql_dbg(ql_dbg_taskm, vha, 0x8003, |
881 | "Abort command mbx failed cmd=%p.\n", cmd); | 888 | "Abort command mbx failed cmd=%p.\n", cmd); |
882 | } else { | 889 | } else { |
@@ -1124,7 +1131,6 @@ static int | |||
1124 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | 1131 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) |
1125 | { | 1132 | { |
1126 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 1133 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
1127 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | ||
1128 | struct qla_hw_data *ha = vha->hw; | 1134 | struct qla_hw_data *ha = vha->hw; |
1129 | int ret = FAILED; | 1135 | int ret = FAILED; |
1130 | unsigned int id, lun; | 1136 | unsigned int id, lun; |
@@ -1133,15 +1139,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
1133 | id = cmd->device->id; | 1139 | id = cmd->device->id; |
1134 | lun = cmd->device->lun; | 1140 | lun = cmd->device->lun; |
1135 | 1141 | ||
1136 | if (!fcport) { | ||
1137 | return ret; | ||
1138 | } | ||
1139 | |||
1140 | ret = fc_block_scsi_eh(cmd); | ||
1141 | if (ret != 0) | ||
1142 | return ret; | ||
1143 | ret = FAILED; | ||
1144 | |||
1145 | ql_log(ql_log_info, vha, 0x8018, | 1142 | ql_log(ql_log_info, vha, 0x8018, |
1146 | "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); | 1143 | "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); |
1147 | 1144 | ||
@@ -2047,7 +2044,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2047 | ha->nvram_data_off = ~0; | 2044 | ha->nvram_data_off = ~0; |
2048 | ha->isp_ops = &qla2100_isp_ops; | 2045 | ha->isp_ops = &qla2100_isp_ops; |
2049 | } else if (IS_QLA2200(ha)) { | 2046 | } else if (IS_QLA2200(ha)) { |
2050 | ha->mbx_count = MAILBOX_REGISTER_COUNT; | 2047 | ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; |
2051 | req_length = REQUEST_ENTRY_CNT_2200; | 2048 | req_length = REQUEST_ENTRY_CNT_2200; |
2052 | rsp_length = RESPONSE_ENTRY_CNT_2100; | 2049 | rsp_length = RESPONSE_ENTRY_CNT_2100; |
2053 | ha->max_loop_id = SNS_LAST_LOOP_ID_2100; | 2050 | ha->max_loop_id = SNS_LAST_LOOP_ID_2100; |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 23f33a6d52d7..29d780c38040 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.03.07.12-k" | 10 | #define QLA2XXX_VERSION "8.03.07.13-k" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index bf8bf79e6a1f..c4670642d023 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/pm_runtime.h> | 8 | #include <linux/pm_runtime.h> |
9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
10 | #include <linux/async.h> | ||
10 | 11 | ||
11 | #include <scsi/scsi.h> | 12 | #include <scsi/scsi.h> |
12 | #include <scsi/scsi_device.h> | 13 | #include <scsi/scsi_device.h> |
@@ -92,6 +93,19 @@ static int scsi_bus_resume_common(struct device *dev) | |||
92 | return err; | 93 | return err; |
93 | } | 94 | } |
94 | 95 | ||
96 | static int scsi_bus_prepare(struct device *dev) | ||
97 | { | ||
98 | if (scsi_is_sdev_device(dev)) { | ||
99 | /* sd probing uses async_schedule. Wait until it finishes. */ | ||
100 | async_synchronize_full(); | ||
101 | |||
102 | } else if (scsi_is_host_device(dev)) { | ||
103 | /* Wait until async scanning is finished */ | ||
104 | scsi_complete_async_scans(); | ||
105 | } | ||
106 | return 0; | ||
107 | } | ||
108 | |||
95 | static int scsi_bus_suspend(struct device *dev) | 109 | static int scsi_bus_suspend(struct device *dev) |
96 | { | 110 | { |
97 | return scsi_bus_suspend_common(dev, PMSG_SUSPEND); | 111 | return scsi_bus_suspend_common(dev, PMSG_SUSPEND); |
@@ -110,6 +124,7 @@ static int scsi_bus_poweroff(struct device *dev) | |||
110 | #else /* CONFIG_PM_SLEEP */ | 124 | #else /* CONFIG_PM_SLEEP */ |
111 | 125 | ||
112 | #define scsi_bus_resume_common NULL | 126 | #define scsi_bus_resume_common NULL |
127 | #define scsi_bus_prepare NULL | ||
113 | #define scsi_bus_suspend NULL | 128 | #define scsi_bus_suspend NULL |
114 | #define scsi_bus_freeze NULL | 129 | #define scsi_bus_freeze NULL |
115 | #define scsi_bus_poweroff NULL | 130 | #define scsi_bus_poweroff NULL |
@@ -218,6 +233,7 @@ void scsi_autopm_put_host(struct Scsi_Host *shost) | |||
218 | #endif /* CONFIG_PM_RUNTIME */ | 233 | #endif /* CONFIG_PM_RUNTIME */ |
219 | 234 | ||
220 | const struct dev_pm_ops scsi_bus_pm_ops = { | 235 | const struct dev_pm_ops scsi_bus_pm_ops = { |
236 | .prepare = scsi_bus_prepare, | ||
221 | .suspend = scsi_bus_suspend, | 237 | .suspend = scsi_bus_suspend, |
222 | .resume = scsi_bus_resume_common, | 238 | .resume = scsi_bus_resume_common, |
223 | .freeze = scsi_bus_freeze, | 239 | .freeze = scsi_bus_freeze, |
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index 68eadd1c67fd..be4fa6d179b1 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -109,6 +109,7 @@ extern void scsi_exit_procfs(void); | |||
109 | #endif /* CONFIG_PROC_FS */ | 109 | #endif /* CONFIG_PROC_FS */ |
110 | 110 | ||
111 | /* scsi_scan.c */ | 111 | /* scsi_scan.c */ |
112 | extern int scsi_complete_async_scans(void); | ||
112 | extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, | 113 | extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, |
113 | unsigned int, unsigned int, int); | 114 | unsigned int, unsigned int, int); |
114 | extern void scsi_forget_host(struct Scsi_Host *); | 115 | extern void scsi_forget_host(struct Scsi_Host *); |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 89da43f73c00..29c4c0480976 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -1815,6 +1815,7 @@ static void scsi_finish_async_scan(struct async_scan_data *data) | |||
1815 | } | 1815 | } |
1816 | spin_unlock(&async_scan_lock); | 1816 | spin_unlock(&async_scan_lock); |
1817 | 1817 | ||
1818 | scsi_autopm_put_host(shost); | ||
1818 | scsi_host_put(shost); | 1819 | scsi_host_put(shost); |
1819 | kfree(data); | 1820 | kfree(data); |
1820 | } | 1821 | } |
@@ -1841,7 +1842,6 @@ static int do_scan_async(void *_data) | |||
1841 | 1842 | ||
1842 | do_scsi_scan_host(shost); | 1843 | do_scsi_scan_host(shost); |
1843 | scsi_finish_async_scan(data); | 1844 | scsi_finish_async_scan(data); |
1844 | scsi_autopm_put_host(shost); | ||
1845 | return 0; | 1845 | return 0; |
1846 | } | 1846 | } |
1847 | 1847 | ||
@@ -1869,7 +1869,7 @@ void scsi_scan_host(struct Scsi_Host *shost) | |||
1869 | p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); | 1869 | p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); |
1870 | if (IS_ERR(p)) | 1870 | if (IS_ERR(p)) |
1871 | do_scan_async(data); | 1871 | do_scan_async(data); |
1872 | /* scsi_autopm_put_host(shost) is called in do_scan_async() */ | 1872 | /* scsi_autopm_put_host(shost) is called in scsi_finish_async_scan() */ |
1873 | } | 1873 | } |
1874 | EXPORT_SYMBOL(scsi_scan_host); | 1874 | EXPORT_SYMBOL(scsi_scan_host); |
1875 | 1875 | ||