Blame SOURCES/bz1751962-nfsserver-1-systemd-perf-improvements.patch

734564
From 530c48138f7dedaf99ae1ca98865d2f8b7432475 Mon Sep 17 00:00:00 2001
734564
From: Eberhard Kuemmerle <E.Kuemmerle@fz-juelich.de>
734564
Date: Thu, 12 Sep 2019 21:10:43 +0200
734564
Subject: [PATCH] nfsserver: performance improvements for systemd enabled
734564
 systems
734564
734564
> I found two critical actions in the script:
734564
> - systemctl status nfs-server  (which also calls journalctl)
734564
> - systemctl list-unit-files
734564
734564
source:
734564
https://lists.clusterlabs.org/pipermail/developers/2019-September/002214.html
734564
---
734564
 heartbeat/nfsserver | 37 +++++++++++++++++++------------------
734564
 1 file changed, 19 insertions(+), 18 deletions(-)
734564
734564
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
734564
index bf59da98e..8527a90f3 100755
734564
--- a/heartbeat/nfsserver
734564
+++ b/heartbeat/nfsserver
734564
@@ -233,24 +233,25 @@ set_exec_mode()
734564
 		return 0
734564
 	fi
734564
 
734564
-	##
734564
-	# Attempt systemd (with nfs-lock.service).
734564
-	##
734564
 	if which systemctl > /dev/null 2>&1; then
734564
-		if systemctl list-unit-files | grep nfs-server > /dev/null && systemctl list-unit-files | grep nfs-lock > /dev/null; then
734564
-			EXEC_MODE=2
734564
-			# when using systemd, the nfs-lock service file handles nfsv3 locking daemons for us.
734564
-			return 0
734564
-		fi
734564
-	fi
734564
+		if systemctl list-unit-files 'nfs-*' | grep nfs-server > /dev/null; then
734564
+
734564
+			##
734564
+			# Attempt systemd (with nfs-lock.service).
734564
+			##
734564
+			if systemctl list-unit-files 'nfs-*' | grep nfs-lock > /dev/null; then
734564
+				EXEC_MODE=2
734564
+				# when using systemd, the nfs-lock service file handles nfsv3 locking daemons for us.
734564
+				return 0
734564
+			fi
734564
 
734564
-	##
734564
-	# Attempt systemd (with rpc-statd.service).
734564
-	##
734564
-	if which systemctl > /dev/null 2>&1; then
734564
-		if systemctl list-unit-files | grep nfs-server > /dev/null && systemctl list-unit-files | grep rpc-statd > /dev/null; then
734564
-			EXEC_MODE=3
734564
-			return 0
734564
+			##
734564
+			# Attempt systemd (with rpc-statd.service).
734564
+			##
734564
+			if systemctl list-unit-files 'rpc-*' | grep rpc-statd > /dev/null; then
734564
+				EXEC_MODE=3
734564
+				return 0
734564
+			fi
734564
 		fi
734564
 	fi
734564
 
734564
@@ -272,12 +273,12 @@ nfs_exec()
734564
 		2) if ! echo $svc | grep -q "\."; then
734564
 			svc="${svc}.service"
734564
 		   fi
734564
-		   systemctl $cmd $svc
734564
+		   systemctl -n0 $cmd $svc
734564
 		   ;;
734564
 		3) if ! echo $svc | grep -q "\."; then
734564
 			svc="${svc}.service"
734564
 		   fi
734564
-		   systemctl $cmd $svc
734564
+		   systemctl -n0 $cmd $svc
734564
 		   ;;
734564
 	esac
734564
 }