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