]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: delegate than move into the target cgroup 3678/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Feb 2021 00:43:51 +0000 (01:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Feb 2021 00:45:47 +0000 (01:45 +0100)
This is a way more sensible model.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 466897dad32f9c5d137a81296ad7f909b247fcf9..6bba836f5633b10c4b07723087b05c70c0d8268f 100644 (file)
@@ -1806,13 +1806,13 @@ static int lxc_spawn(struct lxc_handler *handler)
                goto out_delete_net;
        }
 
-       if (!cgroup_ops->payload_enter(cgroup_ops, handler)) {
-               ERROR("Failed to enter cgroups");
+       if (!cgroup_ops->payload_delegate_controllers(cgroup_ops)) {
+               ERROR("Failed to delegate controllers to payload cgroup");
                goto out_delete_net;
        }
 
-       if (!cgroup_ops->payload_delegate_controllers(cgroup_ops)) {
-               ERROR("Failed to delegate controllers to payload cgroup");
+       if (!cgroup_ops->payload_enter(cgroup_ops, handler)) {
+               ERROR("Failed to enter cgroups");
                goto out_delete_net;
        }
 
@@ -2027,14 +2027,14 @@ int __lxc_start(struct lxc_handler *handler, struct lxc_operations *ops,
                goto out_abort;
        }
 
-       if (!cgroup_ops->monitor_enter(cgroup_ops, handler)) {
-               ERROR("Failed to enter monitor cgroup");
+       if (!cgroup_ops->monitor_delegate_controllers(cgroup_ops)) {
+               ERROR("Failed to delegate controllers to monitor cgroup");
                ret = -1;
                goto out_abort;
        }
 
-       if (!cgroup_ops->monitor_delegate_controllers(cgroup_ops)) {
-               ERROR("Failed to delegate controllers to monitor cgroup");
+       if (!cgroup_ops->monitor_enter(cgroup_ops, handler)) {
+               ERROR("Failed to enter monitor cgroup");
                ret = -1;
                goto out_abort;
        }