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

[Xen-changelog] Perform xenbus operations in shutdown_handler in a transaction.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 1ad652222dbac6d3485e77822387b51e1c3ea7d8
# Parent  36c4d3bb29c83cc847a4880e5755dffce54dbc78
Perform xenbus operations in shutdown_handler in a transaction.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 36c4d3bb29c8 -r 1ad652222dba 
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Tue Sep 13 21:24:03 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Tue Sep 13 21:29:28 2005
@@ -320,19 +320,27 @@
 static void shutdown_handler(struct xenbus_watch *watch, const char *node)
 {
     static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
-
     char *str;
-
+    int err;
+
+ again:
+    err = xenbus_transaction_start("control");
+    if (err)
+       return;
     str = (char *)xenbus_read("control", "shutdown", NULL);
-    /* Ignore read errors. */
-    if (IS_ERR(str))
-        return;
-    if (strlen(str) == 0) {
-        kfree(str);
-        return;
+    /* Ignore read errors and empty reads. */
+    if (XENBUS_IS_ERR_READ(str)) {
+       xenbus_transaction_end(1);
+       return;
     }
 
     xenbus_write("control", "shutdown", "", O_CREAT);
+
+    err = xenbus_transaction_end(0);
+    if (err == -ETIMEDOUT) {
+       kfree(str);
+       goto again;
+    }
 
     if (strcmp(str, "poweroff") == 0)
         shutting_down = SHUTDOWN_POWEROFF;

_______________________________________________
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®.