f8452f
From 8ee1465520ad49892a0a378626ef93abc03f4d4e Mon Sep 17 00:00:00 2001
f8452f
From: Lennart Poettering <lennart@poettering.net>
f8452f
Date: Tue, 5 Mar 2019 18:57:53 +0100
f8452f
Subject: [PATCH] nspawn: move payload to sub-cgroup first, then sync cgroup
f8452f
 trees
f8452f
f8452f
if we sync the legacy and unified trees before moving to the right
f8452f
subcgroup then ultimately the cgroup paths in the hierarchies will be
f8452f
out-of-sync... Hence, let's move the payload first, and sync then.
f8452f
f8452f
Addresses: https://github.com/systemd/systemd/pull/9762#issuecomment-441187979
f8452f
(cherry picked from commit 27da7ef0d09e00eae821f3ef26e1a666fe7aa087)
f8452f
f8452f
Resolves: #1837094
f8452f
---
f8452f
 src/nspawn/nspawn.c | 4 ++--
f8452f
 1 file changed, 2 insertions(+), 2 deletions(-)
f8452f
f8452f
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
f8452f
index 08255b5724..8cb7591f0e 100644
f8452f
--- a/src/nspawn/nspawn.c
f8452f
+++ b/src/nspawn/nspawn.c
f8452f
@@ -3960,11 +3960,11 @@ static int run(int master,
f8452f
         } else if (arg_slice || arg_property)
f8452f
                 log_notice("Machine and scope registration turned off, --slice= and --property= settings will have no effect.");
f8452f
 
f8452f
-        r = sync_cgroup(*pid, arg_unified_cgroup_hierarchy, arg_uid_shift);
f8452f
+        r = create_subcgroup(*pid, arg_keep_unit, arg_unified_cgroup_hierarchy);
f8452f
         if (r < 0)
f8452f
                 return r;
f8452f
 
f8452f
-        r = create_subcgroup(*pid, arg_keep_unit, arg_unified_cgroup_hierarchy);
f8452f
+        r = sync_cgroup(*pid, arg_unified_cgroup_hierarchy, arg_uid_shift);
f8452f
         if (r < 0)
f8452f
                 return r;
f8452f