diff options
author | emellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com> | 2006-04-10 18:17:54 +0100 |
---|---|---|
committer | emellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com> | 2006-04-10 18:17:54 +0100 |
commit | 45fe4ec419c8bb411674575e1f0f706a92072a99 (patch) | |
tree | 5665367d35c3423febd75cceae15b77afa03b8b6 | |
parent | 224cab0dfd3e7696fec21acf5e0cd821328fbe49 (diff) | |
download | xen-45fe4ec419c8bb411674575e1f0f706a92072a99.tar.gz xen-45fe4ec419c8bb411674575e1f0f706a92072a99.tar.bz2 xen-45fe4ec419c8bb411674575e1f0f706a92072a99.zip |
Fix the test inside all_devices_ready, and move it from xenbus_probe (a
postcore_initcall) to a new late_initcall, so that it happens after the
drivers have initialised.
Fixes the reopened bug #549 (I hope).
Signed-off-by: Ewan Mellor <ewan@xensource.com>
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index e9c8315856..945a129cf1 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -3,7 +3,7 @@ * * Copyright (C) 2005 Rusty Russell, IBM Corporation * Copyright (C) 2005 Mike Wray, Hewlett-Packard - * Copyright (C) 2005 XenSource Ltd + * Copyright (C) 2005, 2006 XenSource Ltd * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 @@ -883,7 +883,7 @@ static int all_devices_ready_(struct device *dev, void *data) int *result = data; if (xendev->state != XenbusStateConnected) { - result = 0; + *result = 0; return 1; } @@ -902,8 +902,6 @@ static int all_devices_ready(void) void xenbus_probe(void *unused) { - int i; - BUG_ON((xenstored_ready <= 0)); /* Enumerate devices in xenstore. */ @@ -916,28 +914,6 @@ void xenbus_probe(void *unused) /* Notify others that xenstore is up */ notifier_call_chain(&xenstore_chain, 0, NULL); - - /* On a 10 second timeout, waiting for all devices currently - configured. We need to do this to guarantee that the filesystems - and / or network devices needed for boot are available, before we - can allow the boot to proceed. - - A possible improvement here would be to have the tools add a - per-device flag to the store entry, indicating whether it is needed - at boot time. This would allow people who knew what they were - doing to accelerate their boot slightly, but of course needs tools - or manual intervention to set up those flags correctly. - */ - for (i = 0; i < 10 * HZ; i++) { - if (all_devices_ready()) - return; - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - } - - printk(KERN_WARNING - "XENBUS: Timeout connecting to devices!\n"); } @@ -1072,6 +1048,41 @@ static int __init xenbus_probe_init(void) postcore_initcall(xenbus_probe_init); + +/* + * On a 10 second timeout, wait for all devices currently configured. We need + * to do this to guarantee that the filesystems and / or network devices + * needed for boot are available, before we can allow the boot to proceed. + * + * This needs to be on a late_initcall, to happen after the frontend device + * drivers have been initialised, but before the root fs is mounted. + * + * A possible improvement here would be to have the tools add a per-device + * flag to the store entry, indicating whether it is needed at boot time. + * This would allow people who knew what they were doing to accelerate their + * boot slightly, but of course needs tools or manual intervention to set up + * those flags correctly. + */ +static int __init wait_for_devices(void) +{ + int i; + + for (i = 0; i < 10 * HZ; i++) { + if (all_devices_ready()) { + return; + } + + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1); + } + + printk(KERN_WARNING + "XENBUS: Timeout connecting to devices!\n"); +} + +late_initcall(wait_for_devices); + + /* * Local variables: * c-file-style: "linux" |