Skip to content

Commit

Permalink
[SCSI] Fix scsi_add_device() for async scanning
Browse files Browse the repository at this point in the history
I had thought that all drivers which didn't call scsi_scan_host()
called scsi_scan_target().  Some, such as sbp2, mptsas and libata-scsi,
call scsi_add_device() or __scsi_add_device().  We just need to wait
for the currently executing async scans to complete first.  This is the
same code that's in scsi_scan_target(), except that we have to return
an error instead of void when we're declining to scan at all.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Matthew Wilcox authored and James Bottomley committed Jan 27, 2007
1 parent 7d620a4 commit 938e2ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/scsi/scsi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
struct device *parent = &shost->shost_gendev;
struct scsi_target *starget;

if (strncmp(scsi_scan_type, "none", 4) == 0)
return ERR_PTR(-ENODEV);

if (!shost->async_scan)
scsi_complete_async_scans();

starget = scsi_alloc_target(parent, channel, id);
if (!starget)
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit 938e2ac

Please sign in to comment.