WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] libxl: remove console 0 backend directory from xenst

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxl: remove console 0 backend directory from xenstore on devices destroy
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Mon, 04 Oct 2010 14:21:59 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Mon, 04 Oct 2010 06:23:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# 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