diff --git a/fork-start-statd.patch b/fork-start-statd.patch new file mode 100644 index 0000000..c88a2a2 --- /dev/null +++ b/fork-start-statd.patch @@ -0,0 +1,34 @@ +Index: nfs-utils-1.1.3/utils/mount/network.c +=================================================================== +--- nfs-utils-1.1.3.orig/utils/mount/network.c ++++ nfs-utils-1.1.3/utils/mount/network.c +@@ -694,7 +694,18 @@ int start_statd(void) + #ifdef START_STATD + if (stat(START_STATD, &stb) == 0) { + if (S_ISREG(stb.st_mode) && (stb.st_mode & S_IXUSR)) { +- system(START_STATD); ++ pid_t pid = fork(); ++ switch (pid) { ++ case 0: /* child */ ++ execl(START_STATD, START_STATD, NULL); ++ exit(1); ++ case -1: /* error */ ++ perror("Fork failed"); ++ break; ++ default: /* parent */ ++ waitpid(pid, NULL,0); ++ break; ++ } + if (probe_statd()) + return 1; + } +Index: nfs-utils-1.1.3/utils/statd/start-statd +=================================================================== +--- nfs-utils-1.1.3.orig/utils/statd/start-statd ++++ nfs-utils-1.1.3/utils/statd/start-statd +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/bin/sh -p + # nfsmount calls this script when mounting a filesystem with locking + # enabled, but when statd does not seem to be running (based on + # /var/run/rpc.statd.pid). diff --git a/nfs-utils.changes b/nfs-utils.changes index 0fb2ab1..267a668 100644 --- a/nfs-utils.changes +++ b/nfs-utils.changes @@ -1,3 +1,25 @@ +------------------------------------------------------------------- +Tue Nov 25 06:10:31 CET 2008 - nfbrown@suse.de + +- nfs.init + * Don't 'stop' if root is on NFS. + If we stop NFS if root is on NFS, then + reboot will hang - bnc#439974 + +------------------------------------------------------------------- +Mon Nov 24 00:01:51 CET 2008 - nfbrown@suse.de + +- nfs.init + * Don't try to kill processes with fuser. + it hangs when netowrk is down, and isn't + needed as we use lazy unmount + bnc#445908 + * Don't kill statd if nfsd is still running. +- fork-start-statd.patch + * Don't use 'system' to run start-statd + as this looses our setuid bit. + bnc#447812 + ------------------------------------------------------------------- Fri Nov 21 11:45:58 CET 2008 - hare@suse.de diff --git a/nfs-utils.spec b/nfs-utils.spec index 636406a..e402fd4 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -27,7 +27,7 @@ BuildRequires: libevent Url: http://nfs.sourceforge.net Summary: Support Utilities for Kernel nfsd Version: 1.1.3 -Release: 12 +Release: 13 Group: Productivity/Networking/NFS License: GPL v2 or later BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -51,6 +51,7 @@ Patch1: nfs-utils-1.1.2-try-before-mount.patch Patch2: nfs-utils-1.1.2-connect-UDP.patch Patch3: sm-notify-no-sync.patch Patch4: rpc.gssd-catch-signal.patch +Patch5: fork-start-statd.patch %description This package contains the NFS utilities. You can tune the number of @@ -132,6 +133,7 @@ Authors: %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 cp %{S:6} . %build @@ -290,6 +292,22 @@ rm -rf $RPM_BUILD_ROOT %doc nfs/*.html nfs/*.ps linux-nfs/* README.NFSv4 %changelog +* Tue Nov 25 2008 nfbrown@suse.de +- nfs.init + * Don't 'stop' if root is on NFS. + If we stop NFS if root is on NFS, then + reboot will hang - bnc#439974 +* Mon Nov 24 2008 nfbrown@suse.de +- nfs.init + * Don't try to kill processes with fuser. + it hangs when netowrk is down, and isn't + needed as we use lazy unmount + bnc#445908 + * Don't kill statd if nfsd is still running. +- fork-start-statd.patch + * Don't use 'system' to run start-statd + as this looses our setuid bit. + bnc#447812 * Fri Nov 21 2008 hare@suse.de - export ROOTFS_FSCK=0 to skip fsck for root on NFS (bnc#441234) * Thu Nov 20 2008 nfbrown@suse.de diff --git a/nfs.init b/nfs.init index d5d0615..3ff0c54 100644 --- a/nfs.init +++ b/nfs.init @@ -131,20 +131,6 @@ mount_usr() { done } -close_usr() { - test -n "$usr" -o -n "$opt" -o -n "$mnt" || return - local -i proc=0 - local where - for where in $usr $opt $mnt ; do - fuser -skm -TERM $where && let proc++ - done - test $proc -eq 0 && return - sleep 5 - for where in $usr $opt $mnt ; do - fuser -skm -KILL $where - done -} - do_start_gssd() { for flavor in $flavors; do /sbin/modprobe rpcsec_gss_$flavor @@ -244,17 +230,16 @@ case "$1-$nfs" in stop-yes) echo -n "Shutting down NFS client services:" - # in case we have /usr and/or /opt via nfs terminate all - # processes on them (nfsservers shouldn't do /usr via nfs) - case "$RUNLEVEL" in - [016sS]) close_usr ;; - esac + rootfs=`awk '$2 == "/" && $1 != "rootfs" {print $3}' /proc/mounts` + + if test x$rootfs = xnfs ; then + echo -n " root filesystem is on NFS" + rc_status -s + else + - # - # Unmount background because during long timeouts - # if test "$nfs" = yes ; then - umount -alt nfs,nfs4 & + umount -alt nfs,nfs4 fi # stop gssd @@ -273,16 +258,19 @@ case "$1-$nfs" in rm -f $IDMAPD_CLIENT_STATE fi - # stop rpc.statd + # stop rpc.statd if not needed by server if checkproc $STATD_BIN ; then - echo -n " rpc.statd" - killproc $STATD_BIN + if [ `cat /proc/fs/nfsd/threads 2> /dev/null`0 -eq 0 ]; then + echo -n " rpc.statd" + killproc $STATD_BIN + fi fi umount_rpc_pipefs # rc_status -v + fi ;; restart*|force-reload*) ## Stop the service and regardless of whether it was