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

[Xen-devel] [PATCH] libxl: remove console 0 backend directory from xenstore on devices destroy



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1286198484 -3600
# Node ID d59be7a8e1e3bc439bb01a0f89d43411210fedcb
# Parent  1cae52330eebbe448586c0a173945bc2bf8d631f
libxl: remove console 0 backend directory from xenstore on devices destroy

The is (deliberately) no frontend directory for console 0 in
xenstore. Therefore to avoid leaking
/local/domain/0/backend/console/$domid/0 check explicitly for this
backend directory and remove.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 1cae52330eeb -r d59be7a8e1e3 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Mon Oct 04 11:42:31 2010 +0100
+++ b/tools/libxl/libxl_device.c        Mon Oct 04 14:21:24 2010 +0100
@@ -294,7 +294,7 @@ int libxl__devices_destroy(libxl_ctx *ct
 int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *path, *be_path, *fe_path;
+    char *path, *be_path, *fe_path, *tmp;
     unsigned int num1, num2;
     char **l1 = NULL, **l2 = NULL;
     int i, j, n = 0, n_watches = 0;
@@ -326,6 +326,17 @@ int libxl__devices_destroy(libxl_ctx *ct
             }
         }
     }
+
+    /* console 0 has no frontend directory, check for a backend */
+    be_path = libxl__sprintf(&gc, "/local/domain/0/backend/console/%d/0", 
domid);
+    tmp = xs_read(ctx->xsh, XBT_NULL, be_path, NULL);
+    if (tmp) {
+        if (libxl__device_destroy(ctx, be_path, force) > 0)
+            n_watches++;
+        flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
+        free(tmp);
+    }
+
     if (!force) {
         /* Linux-ism. Most implementations leave the timeout
          * untouched after select. Linux, however, will chip

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.