From: Christian Brauner Date: Sun, 10 Mar 2019 10:46:18 +0000 (+0100) Subject: hooks: drop namespace references before post-stop X-Git-Tag: lxc-3.2.0~118^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=048493a30739347f1e1256fa03fda2d913cd43c9;p=thirdparty%2Flxc.git 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 --- 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);