]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipr: Wait to do async scan until scsi host is initialized
authorBrian King <brking@linux.vnet.ibm.com>
Fri, 15 Jul 2016 19:48:03 +0000 (14:48 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 27 Jul 2016 04:32:07 +0000 (00:32 -0400)
When performing an async scan, make sure the kthread doing scanning
doesn't start before the scsi host is fully initialized.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ipr.c
drivers/scsi/ipr.h

index 1f539c288ae820f6aafb7463688c2c0bc5be4860..95e4834c58ee8d983d0482a2a9188c97404b57b8 100644 (file)
@@ -3288,6 +3288,11 @@ static void ipr_worker_thread(struct work_struct *work)
                return;
        }
 
+       if (!ioa_cfg->scan_enabled) {
+               spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+               return;
+       }
+
 restart:
        do {
                did_work = 0;
@@ -10362,6 +10367,7 @@ static void ipr_remove(struct pci_dev *pdev)
 static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
 {
        struct ipr_ioa_cfg *ioa_cfg;
+       unsigned long flags;
        int rc, i;
 
        rc = ipr_probe_ioa(pdev, dev_id);
@@ -10414,7 +10420,10 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
                }
        }
 
+       spin_lock_irqsave(ioa_cfg->host->host_lock, flags);
+       ioa_cfg->scan_enabled = 1;
        schedule_work(&ioa_cfg->work_q);
+       spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
        return 0;
 }
 
index 1d42c7464dfc96eae7bd686241a5cc761c5a3c0f..cdb51960b53c6d1c5f7687a64226f60ba79cbe1e 100644 (file)
@@ -1478,6 +1478,7 @@ struct ipr_ioa_cfg {
        u8 in_ioa_bringdown:1;
        u8 ioa_unit_checked:1;
        u8 dump_taken:1;
+       u8 scan_enabled:1;
        u8 scan_done:1;
        u8 needs_hard_reset:1;
        u8 dual_raid:1;