Blame SOURCES/nfsserver-mount-rpc_pipefs.patch

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