[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix the test inside all_devices_ready, and move it from xenbus_probe (a



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID bb97f5120d03b6061daef8ce82d103f9e9356ef3
# Parent  c668b024b2c71a75494d2221433405629f9d7596
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@xxxxxxxxxxxxx>

diff -r c668b024b2c7 -r bb97f5120d03 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Apr 10 
15:36:03 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Apr 10 
17:17:54 2006
@@ -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 @@
        int *result = data;
 
        if (xendev->state != XenbusStateConnected) {
-               result = 0;
+               *result = 0;
                return 1;
        }
 
@@ -902,8 +902,6 @@
 
 void xenbus_probe(void *unused)
 {
-       int i;
-
        BUG_ON((xenstored_ready <= 0));
 
        /* Enumerate devices in xenstore. */
@@ -916,28 +914,6 @@
 
        /* 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 @@
 
 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"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.