From 4f6dda6a14abb5aa9337b28226518294c3300f58 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 3 Aug 2012 12:25:29 +0100 Subject: libxl: fix cleanup of tap devices in libxl__device_destroy We pass be_path to tapdisk_destroy but we've already deleted it so it fails to read tapdisk-params. However it appears that we need to destroy the tap device after tearing down xenstore, to avoid the leak reported by Greg Wettstein in <201207312141.q6VLfJje012656@wind.enjellic.com>. So read the tapdisk-params in the cleanup transaction, before the remove, and pass that down to destroy_tapdisk instead. tapdisk-params may of course be NULL if the device isn't a tap device. There is no need to tear down the tap device from libxl__initiate_device_remove since this ultimately calls libxl__device_destroy. Propagate and log errors from libxl__device_destroy_tapdisk. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/libxl/libxl_internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/libxl/libxl_internal.h') diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 674c88172a..cf5d9e92df 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1344,8 +1344,9 @@ _hidden char *libxl__blktap_devpath(libxl__gc *gc, /* libxl__device_destroy_tapdisk: * Destroys any tapdisk process associated with the backend represented * by be_path. + * Always logs on failure. */ -_hidden void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path); +_hidden int libxl__device_destroy_tapdisk(libxl__gc *gc, const char *params); _hidden int libxl__device_from_disk(libxl__gc *gc, uint32_t domid, libxl_device_disk *disk, -- cgit v1.2.3