Blame SOURCES/nfsserver-mount-rpc_pipefs.patch

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