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

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