From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v12 16/17] xl: main_blockdetach don't call destroy if remove succeeds
Date: Wed, 25 Jul 2012 12:19:20 +0100 [thread overview]
Message-ID: <1343215161-27546-17-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1343215161-27546-1-git-send-email-roger.pau@citrix.com>
xl was calling libxl_device_disk_destroy after a successful call to
libxl_device_disk_remove, which leads to an error.
Changes since v10:
* Return error if libxl_device_disk_remove fails.
* Call libxl_device_disk_dispose unconditionally.
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
tools/libxl/xl_cmdimpl.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 4028f54..6df1fbd 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5399,7 +5399,7 @@ int main_blocklist(int argc, char **argv)
int main_blockdetach(int argc, char **argv)
{
- int opt;
+ int opt, rc = 0;
libxl_device_disk disk;
if ((opt = def_getopt(argc, argv, "", "block-detach", 2)) != -1)
@@ -5413,11 +5413,12 @@ int main_blockdetach(int argc, char **argv)
fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
return 1;
}
- if (libxl_device_disk_remove(ctx, domid, &disk, 0)) {
+ rc = libxl_device_disk_remove(ctx, domid, &disk, 0);
+ if (rc) {
fprintf(stderr, "libxl_device_disk_remove failed.\n");
- } else
- libxl_device_disk_destroy(ctx, domid, &disk, 0);
- return 0;
+ }
+ libxl_device_disk_dispose(&disk);
+ return rc;
}
static char *uptime_to_string(unsigned long time, int short_mode)
--
1.7.7.5 (Apple Git-26)
next prev parent reply other threads:[~2012-07-25 11:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 11:19 [PATCH v12 00/17] execute hotplug scripts from libxl Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 01/17] libxl: fix removal of secondary consoles Roger Pau Monne
2012-07-26 10:39 ` Ian Campbell
2012-07-26 10:43 ` Ian Campbell
2012-07-26 10:48 ` Ian Campbell
2012-07-25 11:19 ` [PATCH v12 02/17] libxl: refactor disk addition to take a helper Roger Pau Monne
2012-07-26 11:06 ` Ian Jackson
2012-07-25 11:19 ` [PATCH v12 03/17] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-07-26 11:07 ` Ian Jackson
2012-07-25 11:19 ` [PATCH v12 04/17] libxl: rename vifs to nics Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 05/17] libxl: convert libxl_device_disk_add to an async op Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 06/17] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 07/17] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 08/17] libxl: rename _IOEMU nic type to VIF_IOEMU Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 09/17] libxl: set nic type of stub to PV instead of copying from the parent Roger Pau Monne
2012-07-26 10:38 ` Ian Jackson
2012-07-25 11:19 ` [PATCH v12 10/17] libxl: set correct nic type depending on the guest Roger Pau Monne
2012-07-26 11:08 ` Ian Jackson
2012-07-25 11:19 ` [PATCH v12 11/17] libxl: use libxl__xs_path_cleanup on device_destroy Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 12/17] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 13/17] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-07-25 11:19 ` [PATCH v12 14/17] libxl: convert libxl_device_vkb_add to an async operation Roger Pau Monne
2012-07-26 10:41 ` Ian Jackson
2012-07-25 11:19 ` [PATCH v12 15/17] libxl: convert libxl_device_vfb_add " Roger Pau Monne
2012-07-26 10:41 ` Ian Jackson
2012-07-25 11:19 ` Roger Pau Monne [this message]
2012-07-25 11:19 ` [PATCH v12 17/17] libxl: libxl__xs_path_cleanup don't print error if ENOENT Roger Pau Monne
2012-07-26 9:36 ` [PATCH v12 00/17] execute hotplug scripts from libxl Ian Campbell
2012-07-26 9:41 ` Roger Pau Monne
2012-07-26 9:55 ` Ian Campbell
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=1343215161-27546-17-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=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).