richardphibel / rpms / systemd

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