From gshapiro@gshapiro.net  Sun Oct 14 21:10:33 2001
Return-Path: <gshapiro@gshapiro.net>
Received: from horsey.gshapiro.net (horsey.gshapiro.net [209.220.147.178])
	by hub.freebsd.org (Postfix) with ESMTP id 45C8D37B42C
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Oct 2001 21:10:29 -0700 (PDT)
Received: from horsey.gshapiro.net (gshapiro@localhost [IPv6:::1])
	by horsey.gshapiro.net (8.12.1/8.12.1) with ESMTP id f9F4ASZh051187
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO);
	Sun, 14 Oct 2001 21:10:28 -0700 (PDT)
Received: (from gshapiro@localhost)
	by horsey.gshapiro.net (8.12.1/8.12.1/Submit) id f9F4AScv051186;
	Sun, 14 Oct 2001 21:10:28 -0700 (PDT)
Message-Id: <200110150410.f9F4AScv051186@horsey.gshapiro.net>
Date: Sun, 14 Oct 2001 21:10:28 -0700 (PDT)
From: Gregory Neil Shapiro <gshapiro+freebsd-gnats@gshapiro.net>
To: FreeBSD-gnats-submit@freebsd.org
Subject: /etc/rc.network NFS server startup broken
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31280
>Category:       conf
>Synopsis:       /etc/rc.network NFS server startup broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gshapiro
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 14 21:20:00 PDT 2001
>Closed-Date:    Mon Feb 17 11:13:51 PST 2003
>Last-Modified:  Mon Feb 17 11:13:51 PST 2003
>Originator:     Gregory Neil Shapiro
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD horsey.gshapiro.net 4.4-STABLE FreeBSD 4.4-STABLE #13: Sun Oct 7 17:12:57 PDT 2001 gshapiro@horsey.gshapiro.net:/home/FreeBSD/RELENG_4/obj/sys/HORSEY i386

>Description:

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.

>How-To-Repeat:
>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.

>Release-Note:
>Audit-Trail:

From: Shannon --jj Behrens <jjinux@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: freebsd-gnats@gshapiro.net, jjinux@yahoo.com
Subject: [PATCH] Re: conf/31280: /etc/rc.network NFS server startup broken
Date: Thu, 10 Jan 2002 09:33:11 -0800 (PST)

 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/
Responsible-Changed-From-To: freebsd-bugs->gshapiro 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Sat Jul 13 15:02:21 PDT 2002 
Responsible-Changed-Why:  
Is there a reason you don't own this one? You seem to have the fix. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31280 
State-Changed-From-To: open->patched 
State-Changed-By: gshapiro 
State-Changed-When: Sat Feb 8 13:12:22 PST 2003 
State-Changed-Why:  
The sysctl has been moved in both branches.  defaults/rc.conf has been 
fixed in -CURRENT and will be MFC'ed shortly. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31280 
State-Changed-From-To: patched->closed 
State-Changed-By: gshapiro 
State-Changed-When: Mon Feb 17 11:12:45 PST 2003 
State-Changed-Why:  
The change has been MFC'ed to RELENG_4. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31280 
>Unformatted:
