[Pkg-sysvinit-devel] Patch for fixing boot-time NFS
Steinar H. Gunderson
sgunderson at bigfoot.com
Tue Jul 17 16:03:34 UTC 2007
reassign 433386 initscripts
tags 433386 + patch
thanks
Hi,
As discussed with Petter on IRC, initscripts is going to need fixing in
addition to the latest nfs-common changes. The following patch is a fixed
version of a previous patch I proposed; I've been asked to wait for feedback
for a few days before NMUing. (I'm probably going to NMU Friday 20th if
nothing else happens.) The problem is that ifupdown fires up mountnfs
asynchronously by default, and as such having portmap and nfs-common in S43
and S44 doesn't really help anything (or rather, it creates a race
condition), so mountnfs will still have to start portmap and nfs-common if
there are any NFS mounts (that are not nolock).
Note that the minuses and pluses made by diff can be slightly confusing in
this case; it's probably better to just read the script after applying the
patch.
--- /etc/network/if-up.d/mountnfs 2006-11-26 15:53:36.000000000 +0100
+++ ./debian/initscripts/etc/network/if-up.d/mountnfs 2007-07-17 12:59:45.000000000 +0200
@@ -27,10 +27,9 @@
exec 9<&0 </etc/fstab
- portmap=no
+ start_nfs=no
NETFS=""
NETDEV=""
- gss_or_idmap=no
while read DEV MTPT FSTYPE OPTS REST
do
case "$DEV" in
@@ -47,19 +46,29 @@
;;
esac
case "$FSTYPE" in
- nfs|nfs4)
+ nfs)
+ # NFS filsystems normally require statd and portmap. However,
+ # if nolock is set, portmap and statd are not required for this
+ # file system.
case "$OPTS" in
nolock|*,nolock|nolock,*|*,nolock,*)
+ # no action
;;
*)
- portmap=yes
+ start_nfs=yes
;;
esac
+
+ # However, Kerberos requires gssd, so start nfs-common anyway.
case "$OPTS" in
sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5i,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
- gss_or_idmap=yes
+ start_nfs=yes
;;
esac
+ ;;
+ nfs4)
+ # NFSv4 requires idmapd, so start nfs-common no matter what the options are.
+ start_nfs=yes
;;
smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
;;
@@ -77,40 +86,18 @@
;;
esac
fi
- if [ "$FSTYPE" = "nfs4" ]
- then
- gss_or_idmap=yes
- fi
done
exec 0<&9 9<&-
#
- # With contemporary portmap packages it is no longer necessary
- # to start portmap here because the package has its own initscript.
- # This code will disappear after etch.
- #
- if [ "$portmap" = yes ]
- then
- if [ -x /sbin/portmap ] && ! pidof portmap >/dev/null 2>&1
- then
- if [ -x /etc/init.d/portmap ]
- then
- /etc/init.d/portmap start
- else
- start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap
- sleep 1 # FIXME: Actually synchronize with the process?
- fi
- fi
- fi
-
- #
- # Initialize nfs-common (which starts rpc.gssd and/or
- # rpc.idmapd, and loads the right kernel modules if
+ # Initialize nfs-common (which starts rpc.statd, rpc.gssd
+ # and/or rpc.idmapd, and loads the right kernel modules if
# applicable) if we use Kerberos and/or NFSv4 mounts.
#
- if [ "$gss_or_idmap" = yes ] && [ -x /etc/init.d/nfs-common ]
+ if [ "$start_nfs" = yes ] && [ -x /etc/init.d/portmap ] && [ -x /etc/init.d/nfs-common ]
then
+ /etc/init.d/portmap start
/etc/init.d/nfs-common start
fi
/* Steinar */
--
Homepage: http://www.sesse.net/
More information about the Pkg-sysvinit-devel
mailing list