From 1659d2c52fbf179ccdc8995df393da23e1ac4a825c4d9b32ebed33fb4ce1ab36 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 22 Jul 2013 06:50:28 +0000 Subject: [PATCH] - New sysconfig variables NFS4_SERVER_MINOR_VERSION, GSSD_OPTIONS, NFS_GSSD_AVOID_DNS to enable various configurations. - bug fixes to init scripts to avoid unmounting everything(!) and to avoid corrupting /run/nfs/bind.mounts OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=88 --- nfs-utils.changes | 10 ++++++++++ nfs.init | 29 +++++++++++++++++++---------- nfsserver.init | 15 +++++++++------ sysconfig.nfs | 38 +++++++++++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/nfs-utils.changes b/nfs-utils.changes index c7f47fb..243de59 100644 --- a/nfs-utils.changes +++ b/nfs-utils.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Mon Jul 22 06:47:57 UTC 2013 - nfbrown@suse.com + +- New sysconfig variables + NFS4_SERVER_MINOR_VERSION, GSSD_OPTIONS, + NFS_GSSD_AVOID_DNS + to enable various configurations. +- bug fixes to init scripts to avoid unmounting everything(!) + and to avoid corrupting /run/nfs/bind.mounts + ------------------------------------------------------------------- Mon Jul 22 06:12:53 UTC 2013 - nfbrown@suse.com diff --git a/nfs.init b/nfs.init index fa7a5fa..26a1465 100644 --- a/nfs.init +++ b/nfs.init @@ -17,7 +17,7 @@ # Required-Stop: $network $portmap # Default-Start: 3 5 # Default-Stop: 0 1 2 6 -# Short-Description: NFS client services +# Short-Description: NFS client services # Description: All necessary services for NFS clients ### END INIT INFO @@ -94,6 +94,15 @@ esac if test -n "$flavors" ; then NEED_GSSD=yes fi +if test -n "$GSSD_OPTIONS"; then + NEED_GSSD=yes +fi + +case $NFS_GSSD_AVOID_DNS in + [Nn]*) ignore_dns=-D ;; + [Yy]*) ignore_dns= ;; + * ) ignore_dns=-D +esac if test "$NFS4_SUPPORT" = yes ; then NEED_IDMAPD=yes @@ -153,7 +162,7 @@ do_start_gssd() { /sbin/modprobe rpcsec_gss_$flavor done mount_rpc_pipefs - startproc $GSSD_BIN + startproc $GSSD_BIN $ignore_dns $GSSD_OPTIONS return $? } @@ -196,7 +205,7 @@ case "$1-$nfs" in modprobe nfs grep -E '^(sunrpc|fs.nfs)' /etc/sysctl.conf | sysctl -q -e -n -p - - # in case we need /usr and/or /opt via nfs + # in case we need /usr and/or /opt via nfs mount_usr # sm-notify @@ -231,10 +240,10 @@ case "$1-$nfs" in # It's sometime usefull to mount NFS devices in # background with an ampersand (&) and a sleep time of # two or more seconds, e.g: - # + # # sleep 2 && mount -at nfs,nfs4 & - # sleep 2 - # + # sleep 2 + # if test -n "$mnt" ; then # If network devices are not yet discovered, mounts # might fail, so we might need to 'udevadm settle' to @@ -268,7 +277,7 @@ case "$1-$nfs" in # kill process to maximise chance that umount succeeds mnt=`awk '$3 ~ /^nfs4*$/ {print $2}' /proc/mounts` runlevel=`runlevel | awk '{print $2}'` - if test "$runlevel" -eq 0 -o "$runlevel" -eq 6; then + if test "$runlevel" -eq 0 -o "$runlevel" -eq 6; then if test -n "$mnt" ; then /sbin/mkill -TERM $mnt fi @@ -293,7 +302,7 @@ case "$1-$nfs" in killproc $IDMAPD_BIN fi rm -f $IDMAPD_CLIENT_STATE - fi + fi # stop rpc.statd if not needed by server if checkproc $STATD_BIN ; then @@ -334,7 +343,7 @@ case "$1-$nfs" in echo "gssd not running" rc_failed 3 fi - # + # if test "$NEED_IDMAPD" = yes && ! checkproc $IDMAPD_BIN; then echo "idmapd not running" rc_failed 3 @@ -354,7 +363,7 @@ case "$1-$nfs" in if checkproc ${GSSD_BIN##*/}; then echo -n " gssd" killproc ${GSSD_BIN##*/} - startproc $GSSD_BIN + startproc $GSSD_BIN $ignore_dns $GSSD_OPTIONS fi if checkproc ${IDMAPD_BIN##*/}; then echo -n " idmapd" diff --git a/nfsserver.init b/nfsserver.init index e3c82e8..2325866 100644 --- a/nfsserver.init +++ b/nfsserver.init @@ -44,7 +44,7 @@ rc_reset # 5 - program is not installed # 6 - program is not configured # 7 - program is not running -# +# # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signalling is not supported) are @@ -108,7 +108,7 @@ nfs4_bind_mounts() { echo "NFS: Is it no longer needed and may cease to work." echo "NFS: Please remove these settings." warned=yes - fi + fi >&2 test -d "$export" || mkdir -p "$export" mount -o bind "$dir" "$export" echo "$dir" "$export" @@ -118,7 +118,7 @@ nfs4_bind_mounts() { nfs4_unbind_mounts() { sort -r -k2 $NFSD_BIND_MOUNTS | while read src mountpoint crap; do - umount -l "$mountpoint" + [ -n "$mountpoint" ] && umount -l "$mountpoint" done > $NFSD_BIND_MOUNTS } @@ -188,6 +188,9 @@ case "$1" in if [ "$NFS4_SUPPORT" != "yes" ]; then VERSION_PARAMS="--no-nfs-version 4" fi + if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then + VERSION_PARAMS="$VERSION_PARAMS -nfs-version 4 -nfs-version 4.$NFS4_SERVER_MINOR_VERSION" + fi if [ -n "$NFSV4LEASETIME" -a -f /proc/fs/nfsd/nfsv4leasetime ]; then echo "$NFSV4LEASETIME" > /proc/fs/nfsd/nfsv4leasetime fi @@ -211,7 +214,7 @@ case "$1" in echo $IDMAPD_BIN > $IDMAPD_SERVER_STATE fi # exportfs - /usr/sbin/exportfs -r + /usr/sbin/exportfs -r # rpc.mountd echo -n " mountd" if [ -n "$MOUNTD_PORT" ] ; then @@ -295,7 +298,7 @@ case "$1" in rc_status -v ;; try-restart) - ## Stop the service and if this succeeds (i.e. the + ## Stop the service and if this succeeds (i.e. the ## service was running before), start it again. $0 status >/dev/null && $0 restart @@ -339,7 +342,7 @@ case "$1" in echo -n " idmapd" checkproc $IDMAPD_BIN rc_status -v - fi + fi echo -n " mountd" checkproc /usr/sbin/rpc.mountd rc_status -v diff --git a/sysconfig.nfs b/sysconfig.nfs index 5fe6312..97b7020 100644 --- a/sysconfig.nfs +++ b/sysconfig.nfs @@ -49,15 +49,28 @@ NFS3_SERVER_SUPPORT="yes" ## Default: yes ## ServiceRestart: nfs nfsserver # -# Enable NFSv4 support (yes/no) +# Enable NFSv4 support (server and/or client) (yes/no) # NFS4_SUPPORT="yes" +## Path: Network/File systems/NFS server +## Description: NFSv4 server minor version +## Type: integer +## Default: 0 +## ServiceRestart: nfsserver +# +# Select NFSv4 minor version for server to support (0, 1). +# If '1' is selected, NFSv4.0 will also be supported. +NFS4_SERVER_MINOR_VERSION="0" + ## Path: Network/File systems/NFS server ## Description: Network Status Monitor options ## Type: string ## Default: "" # +# If a fixed port should be used to send reboot notification +# messages to other systems, that port should be given +# here as "-p portnumber". # SM_NOTIFY_OPTIONS="" @@ -133,6 +146,16 @@ SVCGSSD_OPTIONS="" # -H in a high-availability configuration. NFSD_OPTIONS="" +## Path: Network/File systems/NFS server +## Description: Extra options for gssd +## Type: string +## Default: "" +# +# Normally gssd does not require any options. In some circumstances, +# -n, -l or other options might be useful. See "man 8 rpc.gssd" for +# details. Those options can be set here. +GSSD_OPTIONS="" + ## Path: Network/File systems/NFS server ## Description: Extra options for mountd ## Type: string @@ -142,3 +165,16 @@ NFSD_OPTIONS="" # such as --manage-gids. MOUNTD_OPTIONS="" +## Path: Network/File systems/NFS server +## Description: Avoid DNS lookups for kerberos principal +## Type: yesno +## Default: no +## ServiceRestart: gssd +# +# Avoid DNS lookups when determining kerberos identity +# of NFS server (yes/no) +# "yes" is safest, but "no" might be needed to preserve +# correct behaviour at sites that don't use +# Fully Qualified Domain Names when mounting NFS Shares. +# +NFS_GSSD_AVOID_DNS="no"