[lxc-devel] [PATCH] Unset the per-container logfd on destroy

Stéphane Graber stgraber at ubuntu.com
Wed Apr 22 16:39:16 UTC 2015


On Tue, Apr 21, 2015 at 10:49:03PM +0000, Serge Hallyn wrote:
> Do so before we rm the containerdir.  Otherwise if the logfile is set
> to $lxcpath/$name/log, the containerdir won't be fully deleted.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/lxccontainer.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 1fae6d9..f8e57e9 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -2172,6 +2172,14 @@ static bool container_destroy(struct lxc_container *c)
>  		goto out;
>  	}
>  
> +	if (current_config && c->lxc_conf == current_config) {
> +		current_config = NULL;
> +		if (c->lxc_conf->logfd != -1) {
> +			close(c->lxc_conf->logfd);
> +			c->lxc_conf->logfd = -1;
> +		}
> +	}
> +
>  	if (c->lxc_conf && c->lxc_conf->rootfs.path && c->lxc_conf->rootfs.mount) {
>  		if (am_unpriv())
>  			ret = userns_exec_1(c->lxc_conf, bdev_destroy_wrapper, c->lxc_conf);
> -- 
> 2.1.4
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150422/d03776ef/attachment.sig>


More information about the lxc-devel mailing list