scsi: megaraid_sas: unload flag should be set after scsi_remove_host is called
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Fri, 5 Jan 2018 13:27:41 +0000 (05:27 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 11 Jan 2018 04:25:16 +0000 (23:25 -0500)
Issue - Driver returns DID_NO_CONNECT when unload is in progress,
indicated using instance->unload flag. In case of dynamic unload of
driver, this flag is set before calling scsi_remove_host(). While doing
manual driver unload, user will see lots of prints for Sync Cache
command with DID_NO_CONNECT status.

Fix - Set the instance->unload flag after scsi_remove_host(). Allow
device removal process to be completed and do not block any command
before that.  SCSI commands (like SYNC_CACHE) are received (as part of
scsi_remove_host) by driver during unload will be submitted further down
to the drives.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index 4248588..8a0776d 100644 (file)
@@ -6827,7 +6827,6 @@ static void megasas_detach_one(struct pci_dev *pdev)
        u32 pd_seq_map_sz;
 
        instance = pci_get_drvdata(pdev);
-       instance->unload = 1;
        host = instance->host;
        fusion = instance->ctrl_context;
 
@@ -6838,6 +6837,7 @@ static void megasas_detach_one(struct pci_dev *pdev)
        if (instance->fw_crash_state != UNAVAILABLE)
                megasas_free_host_crash_buffer(instance);
        scsi_remove_host(instance->host);
+       instance->unload = 1;
 
        if (megasas_wait_for_adapter_operational(instance))
                goto skip_firing_dcmds;