diff options
author | Mike Frysinger <vapier@gentoo.org> | 2004-06-08 19:04:04 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2004-06-08 19:04:04 +0000 |
commit | 84f6549a14450a8ac2686c6d175b478d2dc203ac (patch) | |
tree | 6a4d3d6ca8741a43891b0c82a65588f4a81cfca5 /net-fs/nfs-utils/files | |
parent | touch up to ouptut (Manifest recommit) (diff) | |
download | gentoo-2-84f6549a14450a8ac2686c6d175b478d2dc203ac.tar.gz gentoo-2-84f6549a14450a8ac2686c6d175b478d2dc203ac.tar.bz2 gentoo-2-84f6549a14450a8ac2686c6d175b478d2dc203ac.zip |
nfsv4 support #25106
Diffstat (limited to 'net-fs/nfs-utils/files')
-rw-r--r-- | net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r2 | 1 | ||||
-rw-r--r-- | net-fs/nfs-utils/files/nfs-4 | 170 |
2 files changed, 171 insertions, 0 deletions
diff --git a/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r2 b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r2 new file mode 100644 index 000000000000..319c3d94379e --- /dev/null +++ b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r2 @@ -0,0 +1 @@ +MD5 f17e9983457e1cf61c37f0be4493fce6 nfs-utils-1.0.6.tar.gz 265964 diff --git a/net-fs/nfs-utils/files/nfs-4 b/net-fs/nfs-utils/files/nfs-4 new file mode 100644 index 000000000000..d10b0b4b16c5 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-4 @@ -0,0 +1,170 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfs-4,v 1.1 2004/06/08 19:04:04 vapier Exp $ + +#--------------------------------------------------------------------------- +# This script starts/stops the following +# rpc.statd if necessary (also checked by init.d/nfsmount) +# rpc.rquotad if exists (from quota package) +# rpc.nfsd +# rpc.mountd +#--------------------------------------------------------------------------- + +# NB: Config is in /etc/conf.d/nfs + +opts="start stop restart reload" + +# This variable is used for controlling whether or not to run exportfs -ua; +# see stop() for more information +restarting=yes + +# The binary locations +exportfs=/usr/sbin/exportfs +statd=/sbin/rpc.statd +rquotad=/usr/sbin/rpc.rquotad +nfsd=/usr/sbin/rpc.nfsd +mountd=/usr/sbin/rpc.mountd + +depend() { + local myneed="net portmap" + if [ -x /sbin/idmapd ] ; then + if grep -q rpc_pipefs /proc/filesystems &>/dev/null; then + myneed="${myneed} idmapd" + fi + fi + need ${myneed} + after quota +} + +start_statd() { + # Don't start rpc.statd if already started by init.d/nfsmount + killall -0 rpc.statd &>/dev/null && return 0 + ebegin "Starting NFS statd" + start-stop-daemon --start --quiet --exec \ + $statd -- $RPCSTATDOPTS 1>&2 + eend $? "Error starting NFS statd" +} + +stop_statd() { + # Don't stop rpc.statd if it's in use by init.d/nfsmount. + mount -t nfs | grep -q . && return 0 + # Make sure it's actually running + killall -0 rpc.statd &>/dev/null || return 0 + # Okay, all tests passed, stop rpc.statd + ebegin "Stopping NFS statd" + start-stop-daemon --stop --quiet --exec $statd 1>&2 + eend $? "Error stopping NFS statd" +} + +start() { + # This is the new "kernel 2.6 way" to handle the exports file + if grep -q nfsd /proc/filesystems &>/dev/null; then + if ! grep -q "nfsd /proc/fs/nfs" /proc/mounts &>/dev/null; then + ebegin "Mounting nfsd filesystem in /proc" + mount -t nfsd nfsd /proc/fs/nfs + eend $? "Error mounting nfsd filesystem in /proc" + fi + fi + # now that nfsd is mounted inside /proc, we can safely start mountd later + + start_statd + + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + if grep -q '^/' /etc/exports &>/dev/null; then + ebegin "Exporting NFS directories" + $exportfs -r 1>&2 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error exporting NFS directories" + fi + + if [ -x $rquotad ]; then + ebegin "Starting NFS rquotad" + start-stop-daemon --start --quiet --exec \ + $rquotad -- $RPCRQUOTADOPTS 1>&2 + eend $? "Error starting NFS rquotad" + fi + + ebegin "Starting NFS daemon" + start-stop-daemon --start --quiet --exec \ + $nfsd -- $RPCNFSDCOUNT 1>&2 + eend $? "Error starting NFS daemon" + + # Start mountd + ebegin "Starting NFS mountd" + start-stop-daemon --start --quiet --exec \ + $mountd -- $RPCMOUNTDOPTS 1>&2 + eend $? "Error starting NFS mountd" +} + +stop() { + # Don't check NFSSERVER variable since it might have changed, + # instead use --oknodo to smooth things over + ebegin "Stopping NFS mountd" + start-stop-daemon --stop --quiet --oknodo \ + --exec $mountd 1>&2 + eend $? "Error stopping NFS mountd" + + # nfsd sets its process name to [nfsd] so don't look for $nfsd + ebegin "Stopping NFS daemon" + start-stop-daemon --stop --quiet --oknodo \ + --name nfsd --user root --signal 2 1>&2 + eend $? "Error stopping NFS daemon" + + if [ -x $rquotad ]; then + ebegin "Stopping NFS rquotad" + start-stop-daemon --stop --quiet --oknodo \ + --exec $rquotad 1>&2 + eend $? "Error stopping NFS rquotad" + fi + + # When restarting the NFS server, running "exportfs -ua" probably + # isn't what the user wants. Running it causes all entries listed + # in xtab to be removed from the kernel export tables, and the + # xtab file is cleared. This effectively shuts down all NFS + # activity, leaving all clients holding stale NFS filehandles, + # *even* when the NFS server has restarted. + # + # That's what you would want if you were shutting down the NFS + # server for good, or for a long period of time, but not when the + # NFS server will be running again in short order. In this case, + # then "exportfs -r" will reread the xtab, and all the current + # clients will be able to resume NFS activity, *without* needing + # to umount/(re)mount the filesystem. + if [ "$restarting" = no ]; then + ebegin "Unexporting NFS directories" + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # shutdown process can continue. + $exportfs -ua 1>&2 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error unexporting NFS directories" + fi + + stop_statd +} + +reload() { + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + ebegin "Reloading /etc/exports" + $exportfs -r 1>&2 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error exporting NFS directories" +} + +restart() { + # See long comment in stop() regarding "restarting" and exportfs -ua + restarting=yes + svc_stop + svc_start +} |