libxl: Seal tapdisk minor leak.
PATCH 1/1 libxl: Seal tapdisk minor leak.
libxl: Seal tapdisk minor leak.
This patch needs to be applied on top of the following patch to establish correct cleanup of a blktap2 based virtual disk:
libxl: attempt to cleanup tapdisk processes on disk backend destroy.
To implement correct cleanup of blktap devices in Xen 4.1.2.
This patch implements the release of the backend device before calling for the destruction of the userspace component of the tapdisk device.
Without this patch the kernel xen-blkback driver deadlocks with the tapdisk 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 for the device to be orphaned.
tools/libxl/libxl_blktap2.c +7 -0
@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxlchar *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); }
tools/libxl/libxl_device.c +1 -2
@@ -250,8 +250,7 @@ int libxl__device_destroy(libxl_ctx *ctxif (!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: [email protected]
------------------------------------------------------------------------------
"More people are killed every year by pigs than by sharks, which shows
you how good we are at evaluating risk."
-- Bruce Schneier
Beyond Fear
Dr. Greg Wettstein writes ("[Patch 1 of 1] [xen-4.1.2] libxl: Seal tapdisk minor leak."):
Quoted 1 line
libxl: Seal tapdisk minor leak.
...
Quoted 1 line
To implement correct cleanup of blktap devices in Xen 4.1.2.
Is this patch is supposed to be against xen-4.1-testing.hg ?
tools/libxl/libxl_blktap2.c void libxl__device_destroy_tapdisk(libxl
Quoted 4 lines
diff -r
b2b7a7a49af5tools/libxl/libxl_blktap2.ctools/libxl/libxl_blktap2.c +0
-0@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxl
This function doesn't seem to exist in my copy of xen-4.1-testing.hg tip nor in 23172:3eca5bf65e6c.
Ian.
Quoted 7 lines · Ian Jackson
Dr. Greg Wettstein writes ("[Patch 1 of 1] [xen-4.1.2] libxl: Seal tapdisk minor leak."):
Quoted 1 line
libxl: Seal tapdisk minor leak.
...
Quoted 1 line
To implement correct cleanup of blktap devices in Xen 4.1.2.
Is this patch is supposed to be against xen-4.1-testing.hg ?
Quoted 7 lines
tools/libxl/libxl_blktap2.c void libxl__device_destroy_tapdisk(libxl
Quoted 4 lines
diff -r
b2b7a7a49af5tools/libxl/libxl_blktap2.ctools/libxl/libxl_blktap2.c +0
-0@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxlThis function doesn't seem to exist in my copy of xen-4.1-testing.hg tip nor in 23172:3eca5bf65e6c.
It comes from <[email protected]> which is a backport request that introduces this function.
Ian.
Ian Campbell writes ("Re: [Xen-devel] [Patch 1 of 1] [xen-4.1.2] libxl: Seal tapdisk minor leak."):
Quoted 16 lines · Ian Jackson
Quoted 7 lines
Dr. Greg Wettstein writes ("[Patch 1 of 1] [xen-4.1.2] libxl: Seal tapdisk minor leak."):
Quoted 1 line
libxl: Seal tapdisk minor leak.
...
Quoted 1 line
To implement correct cleanup of blktap devices in Xen 4.1.2.
Is this patch is supposed to be against xen-4.1-testing.hg ?
Quoted 7 lines
tools/libxl/libxl_blktap2.c void libxl__device_destroy_tapdisk(libxl
Quoted 4 lines
diff -r
b2b7a7a49af5tools/libxl/libxl_blktap2.ctools/libxl/libxl_blktap2.c +0
-0@@ -59,6 +59,7 @@ void libxl__device_destroy_tapdisk(libxlThis function doesn't seem to exist in my copy of xen-4.1-testing.hg tip nor in 23172:3eca5bf65e6c.
Quoted 2 lines
It comes from <[email protected]> which is a backport request that introduces this function.
Oh I see, these are two interdependent patches. Let me read them again.
Ian.