aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/libxl/libxl_blktap2.c7
-rw-r--r--tools/libxl/libxl_device.c1
2 files changed, 7 insertions, 1 deletions
diff --git a/tools/libxl/libxl_blktap2.c b/tools/libxl/libxl_blktap2.c
index 00d8dbbee4..b126f8d6fa 100644
--- a/tools/libxl/libxl_blktap2.c
+++ b/tools/libxl/libxl_blktap2.c
@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path)
char *path, *params, *type, *disk;
int err;
tap_list_t tap;
+ libxl_ctx *ctx = libxl__gc_owner(gc);
path = libxl__sprintf(gc, "%s/tapdisk-params", be_path);
if (!path) return;
@@ -75,5 +76,11 @@ void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path)
err = tap_ctl_find(type, disk, &tap);
if (err < 0) return;
+ /*
+ * Remove the instance of the backend device to avoid a deadlock with the
+ * removal of the tap device.
+ */
+ xs_rm(ctx->xsh, XBT_NULL, be_path);
+
tap_ctl_destroy(tap.id, tap.minor);
}
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 7e8fcef20d..8a92efa3ba 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -251,7 +251,6 @@ int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force)
goto out;
if (atoi(state) != 4) {
libxl__device_destroy_tapdisk(&gc, be_path);
- xs_rm(ctx->xsh, XBT_NULL, be_path);
goto out;
}