From 048493a30739347f1e1256fa03fda2d913cd43c9 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 10 Mar 2019 11:46:18 +0100 Subject: [PATCH] hooks: drop namespace references before post-stop Callers such as LXD run post-stop hooks to perform cleanup operations on shutdown. This can involve umount and other things. To avoid surprises with lingering namespace references we should close all our namespace-preserving file descriptors. We don't need them at this point anymore anyway. Signed-off-by: Christian Brauner --- src/lxc/start.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/start.c b/src/lxc/start.c index c62e56ff0..31fa3f8a4 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -1026,6 +1026,9 @@ void lxc_fini(const char *name, struct lxc_handler *handler) lxc_set_state(name, handler, STOPPED); } + /* Avoid lingering namespace references. */ + lxc_put_nsfds(handler); + ret = run_lxc_hooks(name, "post-stop", handler->conf, NULL); if (ret < 0) { ERROR("Failed to run lxc.hook.post-stop for container \"%s\"", name); -- 2.47.2