ia64/xen-unstable
changeset 9665:bb97f5120d03
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>
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>
author | emellor@leeni.uk.xensource.com |
---|---|
date | Mon Apr 10 18:17:54 2006 +0100 (2006-04-10) |
parents | c668b024b2c7 |
children | ec68212e72c1 |
files | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Apr 10 16:36:03 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Mon Apr 10 18:17:54 2006 +0100 1.3 @@ -3,7 +3,7 @@ 1.4 * 1.5 * Copyright (C) 2005 Rusty Russell, IBM Corporation 1.6 * Copyright (C) 2005 Mike Wray, Hewlett-Packard 1.7 - * Copyright (C) 2005 XenSource Ltd 1.8 + * Copyright (C) 2005, 2006 XenSource Ltd 1.9 * 1.10 * This program is free software; you can redistribute it and/or 1.11 * modify it under the terms of the GNU General Public License version 2 1.12 @@ -883,7 +883,7 @@ static int all_devices_ready_(struct dev 1.13 int *result = data; 1.14 1.15 if (xendev->state != XenbusStateConnected) { 1.16 - result = 0; 1.17 + *result = 0; 1.18 return 1; 1.19 } 1.20 1.21 @@ -902,8 +902,6 @@ static int all_devices_ready(void) 1.22 1.23 void xenbus_probe(void *unused) 1.24 { 1.25 - int i; 1.26 - 1.27 BUG_ON((xenstored_ready <= 0)); 1.28 1.29 /* Enumerate devices in xenstore. */ 1.30 @@ -916,28 +914,6 @@ void xenbus_probe(void *unused) 1.31 1.32 /* Notify others that xenstore is up */ 1.33 notifier_call_chain(&xenstore_chain, 0, NULL); 1.34 - 1.35 - /* On a 10 second timeout, waiting for all devices currently 1.36 - configured. We need to do this to guarantee that the filesystems 1.37 - and / or network devices needed for boot are available, before we 1.38 - can allow the boot to proceed. 1.39 - 1.40 - A possible improvement here would be to have the tools add a 1.41 - per-device flag to the store entry, indicating whether it is needed 1.42 - at boot time. This would allow people who knew what they were 1.43 - doing to accelerate their boot slightly, but of course needs tools 1.44 - or manual intervention to set up those flags correctly. 1.45 - */ 1.46 - for (i = 0; i < 10 * HZ; i++) { 1.47 - if (all_devices_ready()) 1.48 - return; 1.49 - 1.50 - set_current_state(TASK_INTERRUPTIBLE); 1.51 - schedule_timeout(1); 1.52 - } 1.53 - 1.54 - printk(KERN_WARNING 1.55 - "XENBUS: Timeout connecting to devices!\n"); 1.56 } 1.57 1.58 1.59 @@ -1072,6 +1048,41 @@ static int __init xenbus_probe_init(void 1.60 1.61 postcore_initcall(xenbus_probe_init); 1.62 1.63 + 1.64 +/* 1.65 + * On a 10 second timeout, wait for all devices currently configured. We need 1.66 + * to do this to guarantee that the filesystems and / or network devices 1.67 + * needed for boot are available, before we can allow the boot to proceed. 1.68 + * 1.69 + * This needs to be on a late_initcall, to happen after the frontend device 1.70 + * drivers have been initialised, but before the root fs is mounted. 1.71 + * 1.72 + * A possible improvement here would be to have the tools add a per-device 1.73 + * flag to the store entry, indicating whether it is needed at boot time. 1.74 + * This would allow people who knew what they were doing to accelerate their 1.75 + * boot slightly, but of course needs tools or manual intervention to set up 1.76 + * those flags correctly. 1.77 + */ 1.78 +static int __init wait_for_devices(void) 1.79 +{ 1.80 + int i; 1.81 + 1.82 + for (i = 0; i < 10 * HZ; i++) { 1.83 + if (all_devices_ready()) { 1.84 + return; 1.85 + } 1.86 + 1.87 + set_current_state(TASK_INTERRUPTIBLE); 1.88 + schedule_timeout(1); 1.89 + } 1.90 + 1.91 + printk(KERN_WARNING 1.92 + "XENBUS: Timeout connecting to devices!\n"); 1.93 +} 1.94 + 1.95 +late_initcall(wait_for_devices); 1.96 + 1.97 + 1.98 /* 1.99 * Local variables: 1.100 * c-file-style: "linux"