Blame SOURCES/bz1637823-1-nfsserver-mount-rpc_pipefs.patch

391384
From c6b0104ec21a5f4ddbc3c0151a587fed2a35b773 Mon Sep 17 00:00:00 2001
391384
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
391384
Date: Fri, 20 May 2016 15:47:33 +0200
391384
Subject: [PATCH 1/2] nfsserver: mount based on rpcpipefs_dir variable
391384
391384
---
391384
 heartbeat/nfsserver | 24 ++++++++++++------------
391384
 1 file changed, 12 insertions(+), 12 deletions(-)
391384
391384
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
391384
index 3d036a98a..479082169 100755
391384
--- a/heartbeat/nfsserver
391384
+++ b/heartbeat/nfsserver
391384
@@ -177,14 +177,8 @@ esac
391384
 fp="$OCF_RESKEY_nfs_shared_infodir"
391384
 : ${OCF_RESKEY_nfs_notify_cmd="$DEFAULT_NOTIFY_CMD"}
391384
 : ${OCF_RESKEY_nfs_notify_foreground="$DEFAULT_NOTIFY_FOREGROUND"}
391384
-
391384
-if [ -z ${OCF_RESKEY_rpcpipefs_dir} ]; then
391384
-	rpcpipefs_make_dir=$fp/rpc_pipefs
391384
-	rpcpipefs_umount_dir=${DEFAULT_RPCPIPEFS_DIR}
391384
-else
391384
-	rpcpipefs_make_dir=${OCF_RESKEY_rpcpipefs_dir}
391384
-	rpcpipefs_umount_dir=${OCF_RESKEY_rpcpipefs_dir}
391384
-fi
391384
+: ${OCF_RESKEY_rpcpipefs_dir="$DEFAULT_RPCPIPEFS_DIR"}
391384
+OCF_RESKEY_rpcpipefs_dir=${OCF_RESKEY_rpcpipefs_dir%/}
391384
 
391384
 # Use statd folder if it exists
391384
 if [ -d "/var/lib/nfs/statd" ]; then
391384
@@ -409,7 +403,7 @@ prepare_directory ()
391384
 	fi
391384
 
391384
 	[ -d "$fp" ] || mkdir -p $fp
391384
-	[ -d "$rpcpipefs_make_dir" ] || mkdir -p $rpcpipefs_make_dir
391384
+	[ -d "$OCF_RESKEY_rpcpipefs_dir" ] || mkdir -p $OCF_RESKEY_rpcpipefs_dir
391384
 	[ -d "$fp/v4recovery" ] || mkdir -p $fp/v4recovery
391384
 
391384
 	[ -d "$fp/$STATD_DIR" ] || mkdir -p "$fp/$STATD_DIR"
391384
@@ -453,9 +447,13 @@ bind_tree ()
391384
 
391384
 unbind_tree ()
391384
 {
391384
-	if `mount | grep -q " on $rpcpipefs_umount_dir"`; then
391384
-		umount -t rpc_pipefs $rpcpipefs_umount_dir
391384
-	fi
391384
+	local i=1
391384
+	while `mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir"` && [ "$i" -le 10 ]; do
391384
+		ocf_log info "Stop: umount ($i/10 attempts)"
391384
+		umount -t rpc_pipefs $OCF_RESKEY_rpcpipefs_dir
391384
+		sleep 1
391384
+		i=$((i + 1))
391384
+	done
391384
 	if is_bound /var/lib/nfs; then
391384
 		umount /var/lib/nfs
391384
 	fi
391384
@@ -617,6 +615,8 @@ nfsserver_start ()
391384
 	prepare_directory
391384
 	bind_tree
391384
 
391384
+	mount -t rpc_pipefs sunrpc $OCF_RESKEY_rpcpipefs_dir
391384
+
391384
 	# remove the sm-notify pid so sm-notify will be allowed to run again without requiring a reboot.
391384
 	rm -f /var/run/sm-notify.pid
391384
 	#
391384
391384
From c92e8c84b73dde3254f53665a0ef3603418538dc Mon Sep 17 00:00:00 2001
391384
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
391384
Date: Thu, 27 Sep 2018 16:09:09 +0200
391384
Subject: [PATCH 2/2] nfsserver: only mount rpc_pipefs if it's not mounted
391384
391384
also added space to avoid matching similarly named mounts
391384
---
391384
 heartbeat/nfsserver | 6 ++++--
391384
 1 file changed, 4 insertions(+), 2 deletions(-)
391384
391384
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
391384
index 479082169..5412f391b 100755
391384
--- a/heartbeat/nfsserver
391384
+++ b/heartbeat/nfsserver
391384
@@ -448,7 +448,7 @@ bind_tree ()
391384
 unbind_tree ()
391384
 {
391384
 	local i=1
391384
-	while `mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir"` && [ "$i" -le 10 ]; do
391384
+	while `mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir "` && [ "$i" -le 10 ]; do
391384
 		ocf_log info "Stop: umount ($i/10 attempts)"
391384
 		umount -t rpc_pipefs $OCF_RESKEY_rpcpipefs_dir
391384
 		sleep 1
391384
@@ -615,7 +615,9 @@ nfsserver_start ()
391384
 	prepare_directory
391384
 	bind_tree
391384
 
391384
-	mount -t rpc_pipefs sunrpc $OCF_RESKEY_rpcpipefs_dir
391384
+	if ! `mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir "`; then
391384
+		mount -t rpc_pipefs sunrpc $OCF_RESKEY_rpcpipefs_dir
391384
+	fi
391384
 
391384
 	# remove the sm-notify pid so sm-notify will be allowed to run again without requiring a reboot.
391384
 	rm -f /var/run/sm-notify.pid