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

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