Blame SOURCES/bz2090370-CTDB-move-process-to-root-cgroup-if-rt-enabled.patch

930c25
From 99c4f2af92a10155cf072198c72deffaed3883a5 Mon Sep 17 00:00:00 2001
930c25
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
930c25
Date: Wed, 3 Aug 2022 17:20:31 +0200
930c25
Subject: [PATCH] CTDB: move process to root cgroup if realtime scheduling is
930c25
 enabled
930c25
930c25
---
930c25
 heartbeat/CTDB.in           |  2 ++
930c25
 heartbeat/ocf-shellfuncs.in | 12 ++++++++++++
930c25
 2 files changed, 14 insertions(+)
930c25
930c25
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
930c25
index d25d026ca..46f56cfac 100755
930c25
--- a/heartbeat/CTDB.in
930c25
+++ b/heartbeat/CTDB.in
930c25
@@ -709,6 +709,8 @@ EOF
930c25
 invoke_ctdbd() {
930c25
 	local vers="$1"
930c25
 
930c25
+	ocf_move_to_root_cgroup_if_rt_enabled
930c25
+
930c25
 	ocf_version_cmp "$vers" "4.9.0"
930c25
 	if [ "$?" -ne "0" ]; then
930c25
 		# With 4.9+, all ctdbd binary parameters are provided as
930c25
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
930c25
index 6be4e4e30..2c53a967a 100644
930c25
--- a/heartbeat/ocf-shellfuncs.in
930c25
+++ b/heartbeat/ocf-shellfuncs.in
930c25
@@ -672,6 +672,18 @@ EOF
930c25
 	systemctl daemon-reload
930c25
 }
930c25
 
930c25
+# move process to root cgroup if realtime scheduling is enabled
930c25
+ocf_move_to_root_cgroup_if_rt_enabled()
930c25
+{
930c25
+	if [ -e "/sys/fs/cgroup/cpu/cpu.rt_runtime_us" ]; then
930c25
+		echo $$ >> /sys/fs/cgroup/cpu/tasks
930c25
+
930c25
+		if [ "$?" -ne "0" ]; then
930c25
+			ocf_log warn "Unable to move PID $$ to the root cgroup"
930c25
+		fi
930c25
+	fi
930c25
+}
930c25
+
930c25
 # usage: crm_mon_no_validation args...
930c25
 # run crm_mon without any cib schema validation
930c25
 # This is useful when an agent runs in a bundle to avoid potential