Skip to content

Commit 5c29d21

Browse files
authored
Merge pull request #2065 from oalbrigt/nfsserver-rpc-gssd
nfsserver: add ability to set e.g. "pipefs-directory=/run/nfs/rpc_pipefs" in /etc/nfs.conf to avoid issues with non-clustered Kerberized mounts
2 parents 032fcd1 + a4fd26a commit 5c29d21

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

heartbeat/nfsserver

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ set_exec_mode()
264264
##
265265
# If the user defined an init script, It must exist for us to continue
266266
##
267-
if ! $systemd_is_running && [ -n "$OCF_RESKEY_nfs_init_script" ]; then
267+
if [ $systemd_running -ne 0 ] && [ -n "$OCF_RESKEY_nfs_init_script" ]; then
268268
# check_binary will exit the process if init script does not exist
269269
check_binary ${OCF_RESKEY_nfs_init_script}
270270
EXEC_MODE=1
@@ -274,7 +274,7 @@ set_exec_mode()
274274
##
275275
# Check to see if the default init script exists, if so we'll use that.
276276
##
277-
if ! $systemd_is_running && which $DEFAULT_INIT_SCRIPT > /dev/null 2>&1; then
277+
if [ $systemd_running -ne 0 ] && which $DEFAULT_INIT_SCRIPT > /dev/null 2>&1; then
278278
OCF_RESKEY_nfs_init_script=$DEFAULT_INIT_SCRIPT
279279
EXEC_MODE=1
280280
return 0
@@ -780,7 +780,7 @@ nfsserver_start ()
780780
# the uts namespace is useless in that case.
781781
# If systemd is running, mangle the nfs-server.service unit,
782782
# independent of the "EXEC_MODE" we detected.
783-
if $systemd_is_running ; then
783+
if [ $systemd_running -eq 0 ]; then
784784
if [ -z "$OCF_RESKEY_nfs_server_scope" ] ; then
785785
remove_unshare_uts_dropins
786786
else
@@ -789,7 +789,9 @@ nfsserver_start ()
789789
fi
790790

791791
if ! `mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir "`; then
792-
mount -t rpc_pipefs sunrpc $OCF_RESKEY_rpcpipefs_dir
792+
if [ $systemd_running -ne 0 ] || { [ $systemd_running -eq 0 ] && systemctl -q is-enabled var-lib-nfs-rpc_pipefs.mount ;}; then
793+
mount -t rpc_pipefs sunrpc $OCF_RESKEY_rpcpipefs_dir
794+
fi
793795
fi
794796

795797
# remove the sm-notify pid so sm-notify will be allowed to run again without requiring a reboot.
@@ -1003,11 +1005,15 @@ nfsserver_stop ()
10031005
fi
10041006
fi
10051007

1006-
# systemd
1007-
case $EXEC_MODE in
1008-
[23]) nfs_exec stop rpc-gssd > /dev/null 2>&1
1009-
ocf_log info "Stop: rpc-gssd"
1010-
esac
1008+
1009+
if mount | grep -q " on $OCF_RESKEY_rpcpipefs_dir "; then
1010+
# systemd
1011+
case $EXEC_MODE in
1012+
[23])
1013+
nfs_exec stop rpc-gssd > /dev/null 2>&1
1014+
ocf_log info "Stop: rpc-gssd"
1015+
esac
1016+
fi
10111017

10121018
unbind_tree
10131019
rc=$?
@@ -1017,7 +1023,7 @@ nfsserver_stop ()
10171023
ocf_log info "NFS server stopped"
10181024
fi
10191025

1020-
if $systemd_is_running; then
1026+
if [ $systemd_running -eq 0 ]; then
10211027
remove_unshare_uts_dropins
10221028
fi
10231029

@@ -1057,7 +1063,7 @@ nfsserver_validate ()
10571063
}
10581064

10591065
nfsserver_validate
1060-
systemd_is_running && systemd_is_running=true || systemd_is_running=false
1066+
systemd_is_running; systemd_running=$?
10611067

10621068
case $__OCF_ACTION in
10631069
start) nfsserver_start

0 commit comments

Comments
 (0)