Skip to content

Commit 3af968e

Browse files
committed
async: Fix lack of boot-time console due to insufficient synchronization
Our async work synchronization was broken by "async: make sure independent async domains can't accidentally entangle" (commit d5a877e), because it would report the wrong lowest active async ID when there was both running and pending async work. This caused things like no being able to read the root filesystem, resulting in missing console devices and inability to run 'init', causing a boot-time panic. This fixes it by properly returning the lowest pending async ID: if there is any running async work, that will have a lower ID than any pending work, and we should _not_ look at the pending work list. There were alternative patches from Jaswinder and James, but this one also cleans up the code by removing the pointless 'ret' variable and the unnecesary testing for an empty list around 'for_each_entry()' (if the list is empty, the for_each_entry() thing just won't execute). Fixes-bug: http://bugzilla.kernel.org/show_bug.cgi?id=13474 Reported-and-tested-by: Chris Clayton <chris2553@googlemail.com> Cc: Jaswinder Singh Rajput <jaswinder@kernel.org> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 46056be commit 3af968e

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎kernel/async.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,18 @@ extern int initcall_debug;
9292
static async_cookie_t __lowest_in_progress(struct list_head *running)
9393
{
9494
struct async_entry *entry;
95-
async_cookie_t ret = next_cookie; /* begin with "infinity" value */
9695

9796
if (!list_empty(running)) {
9897
entry = list_first_entry(running,
9998
struct async_entry, list);
100-
ret = entry->cookie;
99+
return entry->cookie;
101100
}
102101

103-
if (!list_empty(&async_pending)) {
104-
list_for_each_entry(entry, &async_pending, list)
105-
if (entry->running == running) {
106-
ret = entry->cookie;
107-
break;
108-
}
109-
}
102+
list_for_each_entry(entry, &async_pending, list)
103+
if (entry->running == running)
104+
return entry->cookie;
110105

111-
return ret;
106+
return next_cookie; /* "infinity" value */
112107
}
113108

114109
static async_cookie_t lowest_in_progress(struct list_head *running)

0 commit comments

Comments
 (0)