diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-08-20 11:18:48 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:51:06 -0400 |
commit | a57b1fccdfa65b78481f5e651833d979e545de04 (patch) | |
tree | d70028d8df64fd12d8a583da18a31f9de6a853ae /drivers | |
parent | 31765d7d3da9bb575f80faecae0b931afa3532c6 (diff) |
[SCSI] scsi_scan: Cope with kthread_run failing
If kthread_run failed, we would fail to scan the host, and leak the
allocated async_scan_data. Since using a separate thread is just an
optimisation, do the scan synchronously if we fail to spawn a thread.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 20df7fe4f48f..b53c5f67e372 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -1799,6 +1799,7 @@ static int do_scan_async(void *_data) | |||
1799 | **/ | 1799 | **/ |
1800 | void scsi_scan_host(struct Scsi_Host *shost) | 1800 | void scsi_scan_host(struct Scsi_Host *shost) |
1801 | { | 1801 | { |
1802 | struct task_struct *p; | ||
1802 | struct async_scan_data *data; | 1803 | struct async_scan_data *data; |
1803 | 1804 | ||
1804 | if (strncmp(scsi_scan_type, "none", 4) == 0) | 1805 | if (strncmp(scsi_scan_type, "none", 4) == 0) |
@@ -1810,7 +1811,9 @@ void scsi_scan_host(struct Scsi_Host *shost) | |||
1810 | return; | 1811 | return; |
1811 | } | 1812 | } |
1812 | 1813 | ||
1813 | kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); | 1814 | p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); |
1815 | if (unlikely(IS_ERR(p))) | ||
1816 | do_scan_async(data); | ||
1814 | } | 1817 | } |
1815 | EXPORT_SYMBOL(scsi_scan_host); | 1818 | EXPORT_SYMBOL(scsi_scan_host); |
1816 | 1819 | ||