--- /etc/init.d/nfs 2004-08-11 06:52:18.000000000 +0100 +++ /etc/init.d/nfs-mal 2004-08-11 07:13:12.557031744 +0100 @@ -26,6 +26,9 @@ nfsd=/usr/sbin/rpc.nfsd mountd=/usr/sbin/rpc.mountd +# Exportfs exit status flag +exportfs_status=/tmp/exportfs.status + depend() { local myneed="net portmap" if [ -x /sbin/idmapd ] ; then @@ -57,12 +60,6 @@ eend $? "Error stopping NFS statd" } -waitfor_exportfs() { - local pid=$1 - ( sleep ${EXPORTFSTIMEOUT:-30}; kill -9 $pid &>/dev/null ) & - wait $1 -} - start() { # This is the new "kernel 2.6 way" to handle the exports file if grep -q nfsd /proc/filesystems &>/dev/null; then @@ -76,14 +73,16 @@ 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. + # Exportfs will perform DNS lookups on all hostnames and IPs in the + # exports file. + # Run it in the background, giving it two seconds to reject the exports + # file. if grep -q '^/' /etc/exports &>/dev/null; then ebegin "Exporting NFS directories" - $exportfs -r 1>&2 & - waitfor_exportfs $! - eend $? "Error exporting NFS directories" + [ -f $exportfs_status ] && rm -f $exportfs_status + ( exportfs -r 1>&2 ; echo "$?" >$exportfs_status ) & + sleep 2s + [ -f $exportfs_status ] && [ "$(cat $exportfs_status)" != '0' ] && eend $(cat $exportfs_status) "Error exporting NFS directories" fi if [ -x $rquotad ]; then