From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 2/2] libxl: clean up qemu-save and qemu-resume files Date: Wed, 3 Jun 2015 10:58:51 +0100 Message-ID: <1433325531.7108.47.camel@citrix.com> References: <1433179476-16642-1-git-send-email-wei.liu2@citrix.com> <1433179476-16642-3-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z05Ro-0003rJ-DX for xen-devel@lists.xenproject.org; Wed, 03 Jun 2015 09:58:56 +0000 In-Reply-To: <1433179476-16642-3-git-send-email-wei.liu2@citrix.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: Wei Liu Cc: Xen-devel , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, 2015-06-01 at 18:24 +0100, Wei Liu wrote: > These files are leaked when using qemu-trad stubdom. They are > intermediate files created by libxc. Unfortunately they don't fit well > in our userdata scheme. Clean them up after we destroy guest, we're > sure they are not useful anymore at that point. Could this be done in the parent process at some point following domain_destroy_domid_cb or domain_destroy_cb perhaps? I think we don't want to do things in sub processes which don't need to be, just to keep things simpler, and I think the logging is more reliable too. > > Signed-off-by: Wei Liu > --- > tools/libxl/libxl.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 9117b01..ad2290d 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -1686,6 +1686,15 @@ static void devices_destroy_cb(libxl__egc *egc, > > rc = xc_domain_destroy(ctx->xch, domid); > if (rc < 0) goto badchild; > + /* Clean up qemu-save and qemu-resume files. They are > + * intermediate files created by libxc. Unfortunately they > + * don't fit in existing userdata scheme very well. > + */ > + rc = libxl__remove_file(gc, libxl__device_model_savefile(gc, domid)); > + if (rc < 0) goto badchild; > + rc = libxl__remove_file(gc, > + GCSPRINTF(XC_DEVICE_MODEL_RESTORE_FILE".%u", domid)); > + if (rc < 0) goto badchild; > _exit(0); > > badchild: