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

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