From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 07/11] libxl: do not blunder on if bootloader fails (again)
Date: Wed, 1 Aug 2012 17:24:16 +0100 [thread overview]
Message-ID: <1343838260-17725-8-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1343838260-17725-1-git-send-email-ian.jackson@eu.citrix.com>
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@eu.citrix.com>
---
tools/libxl/libxl_bootloader.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index bfc1b56..e103ee9 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -206,6 +206,7 @@ static int parse_bootloader_result(libxl__egc *egc,
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(libxl__egc *egc,
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(libxl__egc *egc,
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 *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 -----*/
--
1.7.2.5
next prev parent reply other threads:[~2012-08-01 16:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-01 16:24 [PATCH v4 00/11] libxl: Assorted bugfixes Ian Jackson
2012-08-01 16:24 ` [PATCH 01/11] libxl: unify libxl__device_destroy and device_hotplug_done Ian Jackson
2012-08-02 10:11 ` Ian Campbell
2012-08-01 16:24 ` [PATCH 02/11] libxl: react correctly to bootloader pty master POLLHUP Ian Jackson
2012-08-02 10:16 ` Ian Campbell
2012-08-02 11:18 ` Ian Jackson
2012-08-01 16:24 ` [PATCH 03/11] libxl: fix device counting race in libxl__devices_destroy Ian Jackson
2012-08-02 10:18 ` Ian Campbell
2012-08-01 16:24 ` [PATCH 04/11] libxl: fix formatting of DEFINE_DEVICES_ADD Ian Jackson
2012-08-02 10:18 ` Ian Campbell
2012-08-01 16:24 ` [PATCH 05/11] libxl: abolish useless `start' parameter to libxl__add_* Ian Jackson
2012-08-02 10:19 ` Ian Campbell
2012-08-01 16:24 ` [PATCH 06/11] libxl: rename aodevs to multidev Ian Jackson
2012-08-02 10:20 ` Ian Campbell
2012-08-01 16:24 ` Ian Jackson [this message]
2012-08-02 10:22 ` [PATCH 07/11] libxl: do not blunder on if bootloader fails (again) Ian Campbell
2012-08-01 16:24 ` [PATCH 08/11] Debugging machinery for synthesising POLLHUP Ian Jackson
2012-08-01 16:24 ` [PATCH 09/11] libxl: remus: mark TODOs more clearly Ian Jackson
2012-08-02 10:23 ` Ian Campbell
2012-08-02 12:18 ` Shriram Rajagopalan
2012-08-01 16:24 ` [PATCH 10/11] libxl: remove an unused numainfo parameter Ian Jackson
2012-08-02 10:24 ` Ian Campbell
2012-08-02 11:00 ` Dario Faggioli
2012-08-01 16:24 ` [PATCH 11/11] libxl: -Wunused-parameter Ian Jackson
2012-08-02 8:59 ` Ian Campbell
2012-08-02 14:09 ` Ian Jackson
2012-08-02 10:41 ` Ian Campbell
2012-08-02 14:32 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343838260-17725-8-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).