Bug 31280

Summary: /etc/rc.network NFS server startup broken
Product: Base System Reporter: gshapiro+FreeBSD-gnats <gshapiro+FreeBSD-gnats>
Component: confAssignee: Gregory Neil Shapiro <gshapiro>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-STABLE   
Hardware: Any   
OS: Any   

Description gshapiro+FreeBSD-gnats 2001-10-15 05:20:00 UTC
While configuring a host as an NFS server, I noticed some problems with
/etc/rc.network:

In the "nfs_server_enable" section, this is done after starting nfsd:

	if [ -n "${nfs_bufpackets}" ]; then
		sysctl -w vfs.nfs.bufpackets=${nfs_bufpackets} \
			> /dev/null
	fi

The entry in /etc/defaults/rc.conf is:

      nfs_bufpackets="DEFAULT"	# bufspace (in packets) for client (or DEFAULT)

There are a couple of problems with this:

   a. Unless the user overrides in /etc/rc.conf, the command that ends up
      being run at boot is:

	sysctl -w vfs.nfs.bufpackets=DEFAULT

      which is bad as sysctl treats the "DEFAULT" as 0:

	# sysctl -w vfs.nfs.bufpackets=DEFAULT
	vfs.nfs.bufpackets: 4 -> 0

   b. The comment in the /etc/defaults/rc.conf entry says that nfs_bufpackets
      is for the client, not the NFS server.  The usage in
      /usr/src/sys/nfs/nfs_socket.c:nfs_connect() lends credence to it being
      a client-only sysctl.

Fix: 

a. If nfs_bufpackets is set to DEFAULT, don't run the sysctl.
b. Move the nfs_bufpackets code to the nfs_client_enable section of
   /etc/rc.network.
Comment 1 JJ Behrens 2002-01-10 17:33:11 UTC
Based on a couple greps through /sys/nfs*, the poster
is correct that bufpackets is only for nfsclient.
However, this was already fixed in at least CURRENT.
The following patch also skips the sysctl call if the
user leaves ${nfs_bufpackets} to its default value of
DEFAULT (which was the second part of the bug). 

This is my first patch, and I don't even run NFS, so
please be merciful! :)

<http://ironorchid.com/jjinux/patches/nfsbug.diff>

(It's a very small patch, but I couldn't send it using
Yahoo Mail without using copy and paste :)

Best Regards,
-jj

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
Comment 2 Crist J. Clark freebsd_committer freebsd_triage 2002-07-13 23:02:21 UTC
Responsible Changed
From-To: freebsd-bugs->gshapiro

Is there a reason you don't own this one? You seem to have the fix.
Comment 3 Gregory Neil Shapiro freebsd_committer freebsd_triage 2003-02-08 21:12:22 UTC
State Changed
From-To: open->patched

The sysctl has been moved in both branches.  defaults/rc.conf has been 
fixed in -CURRENT and will be MFC'ed shortly.
Comment 4 Gregory Neil Shapiro freebsd_committer freebsd_triage 2003-02-17 19:12:45 UTC
State Changed
From-To: patched->closed

The change has been MFC'ed to RELENG_4.