mpt3sas: delay scsi_add_host call to work with scsi-mq
authorReddy, Sreekanth <Sreekanth.Reddy@avagotech.com>
Mon, 14 Jul 2014 06:31:35 +0000 (12:01 +0530)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Jul 2014 21:17:04 +0000 (17:17 -0400)
In _scsih_probe, delay the call to scsi_add_host until the host has been
fully set up.

Otherwise, the default .can_queue value of 1 causes scsi-mq to set the block
layer request queue size to its minimum size, resulting in awful performance.

In _scsih_probe error handling, call mpt3sas_base_detach rather than
scsi_remove_host to properly clean up in reverse order.

In _scsih_remove, call scsi_remove_host earlier to clean up in reverse order.

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@avagotech.com>
Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_scsih.c

index c608a616941ac2bf1ebd120cc248ca5f9d18d899..93ce2b2baa41f0ce3c4509906978ba6e1afc0432 100644 (file)
@@ -266,7 +266,7 @@ mpt3sas_base_stop_watchdog(struct MPT3SAS_ADAPTER *ioc)
        ioc->fault_reset_work_q = NULL;
        spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
        if (wq) {
-               if (!cancel_delayed_work(&ioc->fault_reset_work))
+               if (!cancel_delayed_work_sync(&ioc->fault_reset_work))
                        flush_workqueue(wq);
                destroy_workqueue(wq);
        }
index 57020d528035506cd19bfca5d6b63fbd6f6802e4..7cf48c5c15a761074cb344d51d5afef442895b18 100644 (file)
@@ -2581,11 +2581,10 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc)
                return;
 
        list_for_each_entry_safe(fw_event, next, &ioc->fw_event_list, list) {
-               if (cancel_delayed_work(&fw_event->delayed_work)) {
+               if (cancel_delayed_work_sync(&fw_event->delayed_work)) {
                        _scsih_fw_event_free(ioc, fw_event);
                        continue;
                }
-               fw_event->cancel_pending_work = 1;
        }
 }
 
@@ -7039,7 +7038,7 @@ static void
 _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)
 {
        /* the queue is being flushed so ignore this event */
-       if (ioc->remove_host || fw_event->cancel_pending_work ||
+       if (ioc->remove_host ||
            ioc->pci_error_recovery) {
                _scsih_fw_event_free(ioc, fw_event);
                return;
@@ -7439,9 +7438,9 @@ static void _scsih_remove(struct pci_dev *pdev)
        }
 
        sas_remove_host(shost);
+       scsi_remove_host(shost);
        mpt3sas_base_detach(ioc);
        list_del(&ioc->list);
-       scsi_remove_host(shost);
        scsi_host_put(shost);
 }
 
@@ -7809,13 +7808,6 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                }
        }
 
-       if ((scsi_add_host(shost, &pdev->dev))) {
-               pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
-                   ioc->name, __FILE__, __LINE__, __func__);
-               list_del(&ioc->list);
-               goto out_add_shost_fail;
-       }
-
        /* register EEDP capabilities with SCSI layer */
        if (prot_mask > 0)
                scsi_host_set_prot(shost, prot_mask);
@@ -7843,15 +7835,21 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                    ioc->name, __FILE__, __LINE__, __func__);
                goto out_attach_fail;
        }
+       if ((scsi_add_host(shost, &pdev->dev))) {
+               pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
+                   ioc->name, __FILE__, __LINE__, __func__);
+               list_del(&ioc->list);
+               goto out_add_shost_fail;
+       }
+
        scsi_scan_host(shost);
        return 0;
-
+out_add_shost_fail:
+       mpt3sas_base_detach(ioc);
  out_attach_fail:
        destroy_workqueue(ioc->firmware_event_thread);
  out_thread_fail:
        list_del(&ioc->list);
-       scsi_remove_host(shost);
- out_add_shost_fail:
        scsi_host_put(shost);
        return -ENODEV;
 }