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