]> git.proxmox.com Git - mirror_lxc.git/commitdiff
hooks: drop namespace references before post-stop
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 10 Mar 2019 10:46:18 +0000 (11:46 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 10 Mar 2019 10:46:18 +0000 (11:46 +0100)
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 <christian.brauner@ubuntu.com>
src/lxc/start.c

index c62e56ff018284b8a282327b7b8f9bf20d41bcff..31fa3f8a4d3acdfecc51241de62383209f8d1b4d 100644 (file)
@@ -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);