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

[Xen-changelog] [xen-4.1-testing] libxl: avoid blktap2 deadlock on cleanup


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
  • Date: Mon, 17 Dec 2012 20:33:13 +0000
  • Delivery-date: Mon, 17 Dec 2012 20:33:37 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Greg Wettstein <greg@xxxxxxxxxxxx>
# Date 1355409358 0
# Node ID 93e17b0cd035bf2fd43c8d14931556c6b35b66cb
# Parent  255a0b6a81041e51fe38ef0e919a6541ffe0d119
libxl: avoid blktap2 deadlock on cleanup

Establishes correct cleanup behavior for blktap devices.  This patch
implements the release of the backend device before calling for
the destruction of the userspace component of the blktap device.

Without this patch the kernel xen-blkback driver deadlocks with
the blktap2 user control plane until the IPC channel is terminated by the
timeout on the select() call.  This results in a noticeable delay
in the termination of the guest and causes the blktap minor
number which had been allocated to be orphaned.

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


diff -r 255a0b6a8104 -r 93e17b0cd035 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c       Wed Dec 12 17:41:15 2012 +0000
+++ b/tools/libxl/libxl_blktap2.c       Thu Dec 13 14:35:58 2012 +0000
@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxl
     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
     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 -r 255a0b6a8104 -r 93e17b0cd035 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Wed Dec 12 17:41:15 2012 +0000
+++ b/tools/libxl/libxl_device.c        Thu Dec 13 14:35:58 2012 +0000
@@ -251,7 +251,6 @@ int libxl__device_destroy(libxl_ctx *ctx
         goto out;
     if (atoi(state) != 4) {
         libxl__device_destroy_tapdisk(&gc, be_path);
-        xs_rm(ctx->xsh, XBT_NULL, be_path);
         goto out;
     }
 

_______________________________________________
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®.