From: neilbrown Date: Tue, 31 Aug 2004 06:21:31 +0000 (+0000) Subject: mount nfsd filesystem at startup, and unmount afterwards X-Git-Tag: nfs-utils-1-0-6-post3~2 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=43a26e8e4675e32d38a652f6f13e96d6b897cfab;p=nfs-utils.git mount nfsd filesystem at startup, and unmount afterwards --- diff --git a/ChangeLog b/ChangeLog index f7ec2da..0ebb3d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-08-31 NeilBrown + + * debian/nfs-kernel-server.init(start,stop) mount the nfsd + filesystem, if available, before starting nfs services, and + unmount it afterwards. + * etc/nodist/nfs-server: ditto + * etc/redhat/nfs.init: likewise + * etc/redhat/nfs: add "MOUNT_NFSD" flag to control above. + 2004-06-08 NeilBrown * utils/exportfs/exportfs.c: Don't rmtab_read if new_cache, it diff --git a/debian/nfs-kernel-server.init b/debian/nfs-kernel-server.init index 0894f20..e800267 100755 --- a/debian/nfs-kernel-server.init +++ b/debian/nfs-kernel-server.init @@ -35,6 +35,11 @@ case "$1" in cd / # daemons should have root dir as cwd if grep -q '^/' /etc/exports then + # Having the 'nfsd' filesystem mounted (if available) + # make client authentication more reliable. + if [ -d /proc/fs/nfsd -a ! -f /proc/fs/nfsd/exports ] + then mount -t nfsd nfsd /proc/fs/nfsd + fi printf "Exporting directories for $DESC..." $PREFIX/sbin/exportfs -r echo "done." @@ -80,6 +85,7 @@ case "$1" in printf "Unexporting directories for $DESC..." $PREFIX/sbin/exportfs -au + if [ -f /proc/fs/nfsd/exports ] ; then umount /proc/fs/nfsd; fi echo "done." ;; diff --git a/etc/nodist/nfs-server b/etc/nodist/nfs-server index 8f1d34b..f164884 100755 --- a/etc/nodist/nfs-server +++ b/etc/nodist/nfs-server @@ -46,6 +46,10 @@ DESC="NFS kernel daemon" # Handle how we were called. case "$1" in start) + if [ -d /proc/fs/nfsd -a ! -f /proc/fs/nfsd/exports ] ; + then + /bin/mount -t nfsd nfsd /proc/fs/nfsd + fi echo -n "Exporting directories for $DESC..." $EXPORTFS -r echo "done." @@ -97,12 +101,14 @@ stop) echo "Unexporting directories for $DESC..." $EXPORTFS -au + if [ -f /proc/fs/nfsd/exports ] ; then /bin/umount -t nfsd nfsd /proc/fs/nfsd ; fi rm -f /var/lock/subsys/$SCRIPT_NAME echo "done." ;; restart) $0 stop + sleep 1 $0 start ;; diff --git a/etc/redhat/nfs b/etc/redhat/nfs index 5e21f1f..2ace4cd 100644 --- a/etc/redhat/nfs +++ b/etc/redhat/nfs @@ -29,3 +29,6 @@ # TUNE_QUEUE to yes will set the values to 256kb. # TUNE_QUEUE="yes" # NFS_QS=262144 + +# Mount /proc/fs/nfsd (2.6 kernel only) +MOUNT_NFSD="yes" diff --git a/etc/redhat/nfs.init b/etc/redhat/nfs.init index ac45937..1ac4213 100755 --- a/etc/redhat/nfs.init +++ b/etc/redhat/nfs.init @@ -50,9 +50,13 @@ if [ "$TUNE_QUEUE" = "yes" ]; then [ -z "$NFS_QS" ] && NFS_QS=262144 fi + # See how we were called. case "$1" in start) + if [ -d /proc/fs/nfsd -a "$MOUNT_NFSD" = "yes" ] ; then + /bin/mount -t nfsd nfsd /proc/fs/nfsd + fi # Start daemons. # Apply input queue increase for nfs server if [ "$TUNE_QUEUE" = "yes" ]; then @@ -144,6 +148,9 @@ case "$1" in # Do it the last so that clients can still access the server # when the server is running. action "Shutting down NFS services: " /usr/sbin/exportfs -au + if [ -d /proc/fs/nfsd -a "$MOUNT_NFSD" = "yes" ] ; then + /bin/umount /proc/fs/nfsd + fi rm -f /var/lock/subsys/nfs ;; status)