ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
2aacef
From 6b22e9c84c00989ea58b1d9df75f2c20eaa2c274 Mon Sep 17 00:00:00 2001
2aacef
From: Jan Macku <jamacku@redhat.com>
2aacef
Date: Fri, 17 Mar 2023 14:00:15 +0100
2aacef
Subject: [PATCH] unit: In cgroupv1, gracefully terminate delegated scopes
2aacef
 again
2aacef
2aacef
Instantly killing delegated scopes is just not viable for our
2aacef
needs in OCP 4.13 in cgroupv1 mode.  We will accept the possibility
2aacef
of timeouts instead.
2aacef
2aacef
Co-authored-by: Colin Walters <walters@verbum.org>
2aacef
2aacef
rhel-only
2aacef
2aacef
Resolves: #2179165
2aacef
---
2aacef
 src/core/unit.c | 7 ++++++-
2aacef
 1 file changed, 6 insertions(+), 1 deletion(-)
2aacef
2aacef
diff --git a/src/core/unit.c b/src/core/unit.c
2aacef
index c319e99d71..0d1a590a3f 100644
2aacef
--- a/src/core/unit.c
2aacef
+++ b/src/core/unit.c
2aacef
@@ -4616,8 +4616,13 @@ int unit_kill_context(
2aacef
                          * however should not exist in non-delegated units. On the unified hierarchy that's different,
2aacef
                          * there we get proper events. Hence rely on them. */
2aacef
 
2aacef
+                        /* (RHEL9): we patch out a check for delegation here that exists upstream
2aacef
+                         * and accept a possible delayed shutdown due to races in favor of
2aacef
+                         * not just insta-killing the processes.
2aacef
+                         */
2aacef
+
2aacef
                         if (cg_unified_controller(SYSTEMD_CGROUP_CONTROLLER) > 0 ||
2aacef
-                            (detect_container() == 0 && !unit_cgroup_delegate(u)))
2aacef
+                            (detect_container() == 0))
2aacef
                                 wait_for_exit = true;
2aacef
 
2aacef
                         if (send_sighup) {