daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
c2dfb7
From f4a34d97bd7e1564a51f590df591cb31a1a3f333 Mon Sep 17 00:00:00 2001
c2dfb7
From: Evgeny Vereshchagin <evvers@ya.ru>
c2dfb7
Date: Mon, 17 Sep 2018 07:12:38 +0000
c2dfb7
Subject: [PATCH] nspawn: chown() the legacy hierarchy when it's used in a
c2dfb7
 container
c2dfb7
c2dfb7
This is a follow-up to 720f0a2f3c928cc9379501a52146be9fbb4d9be2.
c2dfb7
c2dfb7
Closes https://github.com/systemd/systemd/issues/10026
c2dfb7
Closes https://github.com/systemd/systemd/issues/9563
c2dfb7
c2dfb7
(cherry picked from commit 89f180201cd8c0f3ce5cb6e8dd7e2b3cbcf71527)
c2dfb7
c2dfb7
Resolves: 1837094
c2dfb7
---
c2dfb7
 src/nspawn/nspawn-cgroup.c | 2 +-
c2dfb7
 1 file changed, 1 insertion(+), 1 deletion(-)
c2dfb7
c2dfb7
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
c2dfb7
index d8a39a6959..a231622e29 100644
c2dfb7
--- a/src/nspawn/nspawn-cgroup.c
c2dfb7
+++ b/src/nspawn/nspawn-cgroup.c
c2dfb7
@@ -55,7 +55,7 @@ int chown_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
c2dfb7
         if (r < 0)
c2dfb7
                 return log_error_errno(r, "Failed to chown() cgroup %s: %m", fs);
c2dfb7
 
c2dfb7
-        if (unified_requested == CGROUP_UNIFIED_SYSTEMD) {
c2dfb7
+        if (unified_requested == CGROUP_UNIFIED_SYSTEMD || (unified_requested == CGROUP_UNIFIED_NONE && cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER) > 0)) {
c2dfb7
                 _cleanup_free_ char *lfs = NULL;
c2dfb7
                 /* Always propagate access rights from unified to legacy controller */
c2dfb7