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

[Xen-changelog] [xen-unstable] libxl: do not blunder on if bootloader fails (again)


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 07 Aug 2012 20:33:16 +0000
  • Delivery-date: Tue, 07 Aug 2012 20:33:25 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1343984052 -3600
# Node ID f1e7c1142fe515171df742b3748828b758d5f88b
# Parent  a1b583ffbcb0503ad3907253c41986bd65f56ac7
libxl: do not blunder on if bootloader fails (again)

Do not lose the rc value passed to bootloader_callback.  Do not lose
the rc value from the bl when the local disk detach succeeds.

While we're here rationalise the use of bl->rc to make things clearer.
Set it to zero at the start and always update it conditionally; copy
it into bootloader_callback's argument each time.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r a1b583ffbcb0 -r f1e7c1142fe5 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Fri Aug 03 09:54:11 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c    Fri Aug 03 09:54:12 2012 +0100
@@ -206,6 +206,7 @@ static int parse_bootloader_result(libxl
 void libxl__bootloader_init(libxl__bootloader_state *bl)
 {
     assert(bl->ao);
+    bl->rc = 0;
     bl->dls.diskpath = NULL;
     bl->openpty.ao = bl->ao;
     bl->dls.ao = bl->ao;
@@ -255,6 +256,9 @@ static void bootloader_local_detached_cb
 static void bootloader_callback(libxl__egc *egc, libxl__bootloader_state *bl,
                                 int rc)
 {
+    if (!bl->rc)
+        bl->rc = rc;
+
     bootloader_cleanup(egc, bl);
 
     bl->dls.callback = bootloader_local_detached_cb;
@@ -270,9 +274,11 @@ static void bootloader_local_detached_cb
 
     if (rc) {
         LOG(ERROR, "unable to detach locally attached disk");
+        if (!bl->rc)
+            bl->rc = rc;
     }
 
-    bl->callback(egc, bl, rc);
+    bl->callback(egc, bl, bl->rc);
 }
 
 /* might be called at any time, provided it's init'd */
@@ -289,7 +295,8 @@ static void bootloader_stop(libxl__egc *
         if (r) LOGE(WARN, "%sfailed to kill bootloader [%lu]",
                     rc ? "after failure, " : "", (unsigned long)bl->child.pid);
     }
-    bl->rc = rc;
+    if (!bl->rc)
+        bl->rc = rc;
 }
 
 /*----- main flow of control -----*/

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.