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