From 9f03d540a70118d62921f44ce42d9c6fc86cc2be Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 7 Dec 2006 19:29:27 -0700 Subject: [PATCH] --- yaml --- r: 45552 b: refs/heads/master c: 8bcc24127be12967588db0ad0e614be937ee1d5a h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/scsi/scsi_scan.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index b7c3f9ba08fb..4782528994c5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 23be331d9e5077edf07d73813f870d3b895c8593 +refs/heads/master: 8bcc24127be12967588db0ad0e614be937ee1d5a diff --git a/trunk/drivers/scsi/scsi_scan.c b/trunk/drivers/scsi/scsi_scan.c index 14e635aa44ce..13228312fc4d 100644 --- a/trunk/drivers/scsi/scsi_scan.c +++ b/trunk/drivers/scsi/scsi_scan.c @@ -133,12 +133,10 @@ struct async_scan_data { /** * scsi_complete_async_scans - Wait for asynchronous scans to complete * - * Asynchronous scans add themselves to the scanning_hosts list. Once - * that list is empty, we know that the scans are complete. Rather than - * waking up periodically to check the state of the list, we pretend to be - * a scanning task by adding ourselves at the end of the list and going to - * sleep. When the task before us wakes us up, we take ourselves off the - * list and return. + * When this function returns, any host which started scanning before + * this function was called will have finished its scan. Hosts which + * started scanning after this function was called may or may not have + * finished. */ int scsi_complete_async_scans(void) { @@ -171,6 +169,11 @@ int scsi_complete_async_scans(void) spin_lock(&async_scan_lock); list_del(&data->list); + if (!list_empty(&scanning_hosts)) { + struct async_scan_data *next = list_entry(scanning_hosts.next, + struct async_scan_data, list); + complete(&next->prev_finished); + } done: spin_unlock(&async_scan_lock);