Skip to content

Commit

Permalink
ipr: Wait to do async scan until scsi host is initialized
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian King authored and Martin K. Petersen committed Jul 27, 2016
1 parent b2c0627 commit b195d5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/scsi/ipr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/ipr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b195d5e

Please sign in to comment.