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 <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2019-03-10 11:46:18 +01:00
parent b5bd9e1172
commit 048493a307
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View 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);