Skip site navigation (1)Skip section navigation (2)
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:   conf/31280: /etc/rc.network NFS server startup broken
Message-ID:  <200110150410.f9F4AScv051186@horsey.gshapiro.net>

next in thread | raw e-mail | index | archive | help

>Number:         31280
>Category:       conf
>Synopsis:       /etc/rc.network NFS server startup broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 14 21:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>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:

1. On a system which doesn't have NFS built into the kernel, the nfs.ko
   kernel module is loaded dynamically when nfsd is started.  However,
   if nfs_reserved_port_only is set in /etc/rc.conf, the order of operations
   is:

	- Set vfs.nfs.nfs_privport sysctl
	- Start nfsd

   This doesn't work as the sysctl isn't defined until nfs.ko is loaded, which
   isn't until nfsd is started.

2. 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:

1. Detect and kldload nfs.ko in /etc/rc.network before setting the
   vfs.nfs.nfs_privport sysctl.
2. 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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110150410.f9F4AScv051186>