From: Ian Campbell Subject: Re: [PATCH 2/2] 4.1.2 blktap2 cleanup fixes. Date: Wed, 7 Nov 2012 08:23:36 +0100 Message-ID: <1352273016.12977.21.camel@hastur.hellion.org.uk> References: <201211070207.qA727wF1028601@wind.enjellic.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <201211070207.qA727wF1028601@wind.enjellic.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "greg@enjellic.com" Cc: "Keir (Xen.org)" , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2012-11-07 at 02:07 +0000, Dr. Greg Wettstein wrote: > --------------------------------------------------------------------------- > The following patch when applied on top of: > > libxl: attempt to cleanup tapdisk processes on disk backend destroy. > > 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 Acked-by: Ian Campbell > diff -r b184698e0893 tools/libxl/libxl_blktap2.c > --- a/tools/libxl/libxl_blktap2.c Tue Nov 06 19:53:48 2012 -0600 > +++ b/tools/libxl/libxl_blktap2.c Tue Nov 06 19:54:23 2012 -0600 > @@ -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 b184698e0893 tools/libxl/libxl_device.c > --- a/tools/libxl/libxl_device.c Tue Nov 06 19:53:48 2012 -0600 > +++ b/tools/libxl/libxl_device.c Tue Nov 06 19:54:23 2012 -0600 > @@ -250,8 +250,7 @@ int libxl__device_destroy(libxl_ctx *ctx > if (!state) > goto out; > if (atoi(state) != 4) { > - libxl__device_destroy_tapdisk(&gc, be_path); > - xs_rm(ctx->xsh, XBT_NULL, be_path); > + libxl__device_destroy_tapdisk(&gc, be_path); > goto out; > } > > --------------------------------------------------------------------------- > > As always, > Dr. G.W. Wettstein, Ph.D. Enjellic Systems Development, LLC. > 4206 N. 19th Ave. Specializing in information infra-structure > Fargo, ND 58102 development. > PH: 701-281-1686 > FAX: 701-281-3949 EMAIL: greg@enjellic.com > ------------------------------------------------------------------------------ > "Fungus doesn't take a vacation." > -- Rob Pike > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel