Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mpt2sas: delay scsi_add_host call to work with scsi-mq

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>

authored by

Reddy, Sreekanth and committed by
Christoph Hellwig
02b77081 3533f860

+13 -14
+1 -1
drivers/scsi/mpt2sas/mpt2sas_base.c
··· 277 277 ioc->fault_reset_work_q = NULL; 278 278 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 279 279 if (wq) { 280 - if (!cancel_delayed_work(&ioc->fault_reset_work)) 280 + if (!cancel_delayed_work_sync(&ioc->fault_reset_work)) 281 281 flush_workqueue(wq); 282 282 destroy_workqueue(wq); 283 283 }
+12 -13
drivers/scsi/mpt2sas/mpt2sas_scsih.c
··· 2900 2900 return; 2901 2901 2902 2902 list_for_each_entry_safe(fw_event, next, &ioc->fw_event_list, list) { 2903 - if (cancel_delayed_work(&fw_event->delayed_work)) { 2903 + if (cancel_delayed_work_sync(&fw_event->delayed_work)) { 2904 2904 _scsih_fw_event_free(ioc, fw_event); 2905 2905 continue; 2906 2906 } 2907 - fw_event->cancel_pending_work = 1; 2908 2907 } 2909 2908 } 2910 2909 ··· 7418 7419 struct MPT2SAS_ADAPTER *ioc = fw_event->ioc; 7419 7420 7420 7421 /* the queue is being flushed so ignore this event */ 7421 - if (ioc->remove_host || fw_event->cancel_pending_work || 7422 + if (ioc->remove_host || 7422 7423 ioc->pci_error_recovery) { 7423 7424 _scsih_fw_event_free(ioc, fw_event); 7424 7425 return; ··· 7866 7867 } 7867 7868 7868 7869 sas_remove_host(shost); 7870 + scsi_remove_host(shost); 7869 7871 mpt2sas_base_detach(ioc); 7870 7872 list_del(&ioc->list); 7871 - scsi_remove_host(shost); 7872 7873 scsi_host_put(shost); 7873 7874 } 7874 7875 ··· 8209 8210 } 8210 8211 } 8211 8212 8212 - if ((scsi_add_host(shost, &pdev->dev))) { 8213 - printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", 8214 - ioc->name, __FILE__, __LINE__, __func__); 8215 - list_del(&ioc->list); 8216 - goto out_add_shost_fail; 8217 - } 8218 - 8219 8213 /* register EEDP capabilities with SCSI layer */ 8220 8214 if (prot_mask) 8221 8215 scsi_host_set_prot(shost, prot_mask); ··· 8250 8258 } 8251 8259 } else 8252 8260 ioc->hide_drives = 0; 8261 + 8262 + if ((scsi_add_host(shost, &pdev->dev))) { 8263 + printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", 8264 + ioc->name, __FILE__, __LINE__, __func__); 8265 + goto out_add_shost_fail; 8266 + } 8267 + 8253 8268 scsi_scan_host(shost); 8254 8269 8255 8270 return 0; 8256 8271 8272 + out_add_shost_fail: 8273 + mpt2sas_base_detach(ioc); 8257 8274 out_attach_fail: 8258 8275 destroy_workqueue(ioc->firmware_event_thread); 8259 8276 out_thread_fail: 8260 8277 list_del(&ioc->list); 8261 - scsi_remove_host(shost); 8262 - out_add_shost_fail: 8263 8278 scsi_host_put(shost); 8264 8279 return -ENODEV; 8265 8280 }