WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Perform xenbus operations in shutdown_handler in a trans

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Perform xenbus operations in shutdown_handler in a transaction.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Sep 2005 21:30:13 +0000
Delivery-date: Tue, 13 Sep 2005 21:28:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Perform xenbus operations in shutdown_handler in a transaction., Xen patchbot -unstable <=