In _scsih_probe, delay the call to scsi_add_host until
the host template has been completely filled in.

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 <[email protected]>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 18e713d..529b5fd 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7431,9 +7431,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);
 }
 
@@ -7801,13 +7801,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);
@@ -7835,15 +7828,22 @@ _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__);
+               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;
 }

---
Rob Elliott    HP Server Storage



N�����r��y����b�X��ǧv�^�)޺{.n�+����{���"�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�m��������zZ+�����ݢj"��!�i

Reply via email to