2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 07:19:36 +00:00

Merge pull request #1058 from hallyn/2016-06-24/eric.cgns

container start: clone newcgroup immediately
This commit is contained in:
Christian Brauner
2016-11-02 19:56:28 -06:00
committed by GitHub

View File

@@ -934,11 +934,6 @@ static int do_start(void *data)
devnull_fd = -1;
}
if (cgns_supported() && unshare(CLONE_NEWCGROUP) != 0) {
SYSERROR("Failed to unshare cgroup namespace");
goto out_warn_father;
}
setsid();
/* after this call, we are in error because this
@@ -1161,7 +1156,11 @@ static int lxc_spawn(struct lxc_handler *handler)
flags = handler->clone_flags;
if (handler->clone_flags & CLONE_NEWUSER)
flags &= ~CLONE_NEWNET;
handler->pid = lxc_clone(do_start, handler, handler->clone_flags);
if (cgns_supported()) {
handler->clone_flags |= CLONE_NEWCGROUP;
flags |= CLONE_NEWCGROUP;
}
handler->pid = lxc_clone(do_start, handler, flags);
if (handler->pid < 0) {
SYSERROR("failed to fork into a new namespace");
goto out_delete_net;