提交 a57b1fcc 编写于 作者: M Matthew Wilcox 提交者: James Bottomley

[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: NMatthew Wilcox <matthew@wil.cx>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 31765d7d
......@@ -1799,6 +1799,7 @@ static int do_scan_async(void *_data)
**/
void scsi_scan_host(struct Scsi_Host *shost)
{
struct task_struct *p;
struct async_scan_data *data;
if (strncmp(scsi_scan_type, "none", 4) == 0)
......@@ -1810,7 +1811,9 @@ void scsi_scan_host(struct Scsi_Host *shost)
return;
}
kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
if (unlikely(IS_ERR(p)))
do_scan_async(data);
}
EXPORT_SYMBOL(scsi_scan_host);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册