daandemeyer / rpms / systemd

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