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

Serge Hallyn serge.hallyn at ubuntu.com
Tue Apr 21 22:49:03 UTC 2015


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>
---
 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



More information about the lxc-devel mailing list