Bug 20774

Summary: 'NFS access cache time=2' is not a daemon
Product: Base System Reporter: Andre Albsmeier <Andre.Albsmeier>
Component: confAssignee: Doug Barton <dougb>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Andre Albsmeier 2000-08-22 08:00:01 UTC
When booting a NFS client, the following line is spit out:

Starting final network daemons: mountd nfsd nfsiod NFS access cache time=2 amd rwhod.

It is generated from these lines in /etc/rc.network:

        case ${nfs_client_enable} in
        [Yy][Ee][Ss])
                echo -n ' nfsiod';      nfsiod ${nfs_client_flags}
                if [ -n "${nfs_access_cache}" ]; then
                echo -n " NFS access cache time=${nfs_access_cache}"
                sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} \
                        >/dev/null
                fi
                ;;
        esac

Since 'NFS access cache time=2' is not a daemon we might shut it up
or move it somewhere else, e.g.:

Additional network settings:  NFS access cache time=2

Fix: Patch for moving it to an additional section:
How-To-Repeat: 
Boot a NFS client.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-08-22 15:39:23 UTC
Responsible Changed
From-To: freebsd-bugs->sheldonh

This one was sent for my attention.
Comment 2 Sheldon Hearn 2000-08-22 15:43:25 UTC
On Tue, 22 Aug 2000 08:54:13 +0200, Andre Albsmeier wrote:

> Since 'NFS access cache time=2' is not a daemon we might shut it up
> or move it somewhere else, e.g.:
> 
> Additional network settings:  NFS access cache time=2

Do you agree, though, that for the purpose of backward compatibility,
the test for whether or not to frob the sysctl should test not only the
value of nfs_access_cache, but also the value of nfs_client_enable?

i.e.

	echo -n 'Additional network settings:'

	case ${nfs_client_enable} in
	[Yy][Ee][Ss])

		if [ -n "${nfs_access_cache}" ]; then
			echo -n " NFS access cache time=${nfs_access_cache}"
			sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} > /dev/null
		fi
		;;
	esac

	echo '.'

Ciao,
Sheldon.
Comment 3 Andre Albsmeier 2000-08-22 16:38:24 UTC
On Tue, 22-Aug-2000 at 16:43:25 +0200, Sheldon Hearn wrote:
> 
> 
> On Tue, 22 Aug 2000 08:54:13 +0200, Andre Albsmeier wrote:
> 
> > Since 'NFS access cache time=2' is not a daemon we might shut it up
> > or move it somewhere else, e.g.:
> > 
> > Additional network settings:  NFS access cache time=2
> 
> Do you agree, though, that for the purpose of backward compatibility,
> the test for whether or not to frob the sysctl should test not only the
> value of nfs_access_cache, but also the value of nfs_client_enable?

Yes. It would work even without testing nfs_client_enable but
would probably fail if no NFS support was compiled into the kernel

	-Andre

> 
> i.e.
> 
> 	echo -n 'Additional network settings:'
> 
> 	case ${nfs_client_enable} in
> 	[Yy][Ee][Ss])
> 
> 		if [ -n "${nfs_access_cache}" ]; then
> 			echo -n " NFS access cache time=${nfs_access_cache}"
> 			sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} > /dev/null
> 		fi
> 		;;
> 	esac
> 
> 	echo '.'
> 
> Ciao,
> Sheldon.
Comment 4 Sheldon Hearn 2000-08-22 17:23:49 UTC
On Tue, 22 Aug 2000 17:38:24 +0200, Andre Albsmeier wrote:

> Yes. It would work even without testing nfs_client_enable but
> would probably fail if no NFS support was compiled into the kernel

I had a look and decided that it's not really important to limit the
output associated with "starting daemons" to daemon names.  It's
perfectly acceptable to include output relating to the operation of
those daemons.  I think. :-)

However, Bruce Evans' rev 1.46 of src/etc/rc lured me in, and I think
that something like this might be helpful.

Bruce, is this what you had in mind?

Ciao,
Sheldon.

Index: rc.network
===================================================================
RCS file: /home/ncvs/src/etc/rc.network,v
retrieving revision 1.83
diff -u -d -r1.83 rc.network
--- rc.network	2000/08/16 23:08:28	1.83
+++ rc.network	2000/08/22 16:19:20
@@ -8,6 +8,11 @@
 # first before contemplating any changes here.  If you do need to change
 # this file for some reason, we would like to know about it.
 
+
+v_set_sysctl() {
+	echo -n " '`sysctl -w $1 2>&1`'"
+}
+
 # First pass startup stuff.
 #
 network_pass1() {
@@ -270,85 +275,73 @@
 	[Yy][Ee][Ss] | '')
 		;;
 	*)
-		echo -n ' tcp extensions=NO'
-		sysctl -w net.inet.tcp.rfc1323=0 >/dev/null
+		v_set_sysctl net.inet.tcp.rfc1323=0
 		;;
 	esac
 
 	case ${icmp_bmcastecho} in
 	[Yy][Ee][Ss])
-		echo -n ' broadcast ping responses=YES'
-		sysctl -w net.inet.icmp.bmcastecho=1 >/dev/null
+		v_set_sysctl net.inet.icmp.bmcastecho=1
 		;;
 	esac
 
 	case ${icmp_drop_redirect} in
 	[Yy][Ee][Ss])
-		echo -n ' ignore ICMP redirect=YES'
-		sysctl -w net.inet.icmp.drop_redirect=1 >/dev/null
+		v_set_sysctl net.inet.icmp.drop_redirect=1
 		;;
 	esac
 
 	case ${icmp_log_redirect} in
 	[Yy][Ee][Ss])
-		echo -n ' log ICMP redirect=YES'
-		sysctl -w net.inet.icmp.log_redirect=1 >/dev/null
+		v_set_sysctl net.inet.icmp.log_redirect=1
 		;;
 	esac
 
 	case ${gateway_enable} in
 	[Yy][Ee][Ss])
-		echo -n ' IP gateway=YES'
-		sysctl -w net.inet.ip.forwarding=1 >/dev/null
+		v_set_sysctl net.inet.ip.forwarding=1
 		;;
 	esac
 
 	case ${forward_sourceroute} in
 	[Yy][Ee][Ss])
-		echo -n ' do source routing=YES'
-		sysctl -w net.inet.ip.sourceroute=1 >/dev/null
+		v_set_sysctl net.inet.ip.sourceroute=1
 		;;
 	esac
 
 	case ${accept_sourceroute} in
 	[Yy][Ee][Ss])
-		echo -n ' accept source routing=YES'
-		sysctl -w net.inet.ip.accept_sourceroute=1 >/dev/null
+		v_set_sysctl net.inet.ip.accept_sourceroute=1
 		;;
 	esac
 
 	case ${tcp_keepalive} in
 	[Yy][Ee][Ss])
-		echo -n ' TCP keepalive=YES'
-		sysctl -w net.inet.tcp.always_keepalive=1 >/dev/null
+		v_set_sysctl net.inet.tcp.always_keepalive=1
 		;;
 	esac
 
 	case ${tcp_restrict_rst} in
 	[Yy][Ee][Ss])
-		echo -n ' restrict TCP reset=YES'
-		sysctl -w net.inet.tcp.restrict_rst=1 >/dev/null
+		v_set_sysctl net.inet.tcp.restrict_rst=1
 		;;
 	esac
 
 	case ${tcp_drop_synfin} in
 	[Yy][Ee][Ss])
-		echo -n ' drop SYN+FIN packets=YES'
-		sysctl -w net.inet.tcp.drop_synfin=1 >/dev/null
+		v_set_sysctl net.inet.tcp.drop_synfin=1
 		;;
 	esac
 
 	case ${ipxgateway_enable} in
 	[Yy][Ee][Ss])
-		echo -n ' IPX gateway=YES'
-		sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null
+		v_set_sysctl net.ipx.ipx.ipxforwarding=1
 		;;
 	esac
 
 	case ${arpproxy_all} in
 	[Yy][Ee][Ss])
-		echo -n ' ARP proxyall=YES'
-		sysctl -w net.link.ether.inet.proxyall=1 >/dev/null
+		v_set_sysctl net.link.ether.inet.proxyall=1
 		;;
 	esac
 
@@ -356,8 +349,7 @@
 	[Nn][Oo] | '')
 		;;
 	*)
-		echo -n ' ip_portrange_first=$ip_portrange_first'
-		sysctl -w net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
+		v_set_sysctl net.inet.ip.portrange.first=$ip_portrange_first
 		;;
 	esac
 
@@ -365,8 +357,7 @@
 	[Nn][Oo] | '')
 		;;
 	*)
-		echo -n ' ip_portrange_last=$ip_portrange_last'
-		sysctl -w net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
+		v_set_sysctl net.inet.ip.portrange.last=$ip_portrange_last
 		;;
 	esac
 
@@ -527,15 +518,14 @@
 
 			case ${nfs_reserved_port_only} in
 			[Yy][Ee][Ss])
-				echo -n ' NFS on reserved port only=YES'
-				sysctl -w vfs.nfs.nfs_privport=1 >/dev/null
+				v_set_sysctl vfs.nfs.nfs_privport=1
 				;;
 			esac
 
 			echo -n ' nfsd';	nfsd ${nfs_server_flags}
 
 			if [ -n "${nfs_bufpackets}" ]; then
-				sysctl -w vfs.nfs.bufpackets=${nfs_bufpackets} \
+				v_set_sysctl vfs.nfs.bufpackets=${nfs_bufpackets} \
 					> /dev/null
 			fi
 
@@ -575,9 +565,7 @@
 	[Yy][Ee][Ss])
 		echo -n ' nfsiod';	nfsiod ${nfs_client_flags}
 		if [ -n "${nfs_access_cache}" ]; then
-		echo -n " NFS access cache time=${nfs_access_cache}"
-		sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} \
-			>/dev/null
+		v_set_sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache}
 		fi
 		;;
 	esac
@@ -672,9 +660,8 @@
 	[Nn][Oo] | '')
 		;;
 	*)
-		echo -n ' log_in_vain=YES'
-		sysctl -w net.inet.tcp.log_in_vain=1 >/dev/null
-		sysctl -w net.inet.udp.log_in_vain=1 >/dev/null
+		v_set_sysctl net.inet.tcp.log_in_vain=1
+		v_set_sysctl net.inet.udp.log_in_vain=1
 		;;
 	esac
Comment 5 Andre Albsmeier 2000-08-22 19:22:20 UTC
On Tue, 22-Aug-2000 at 18:23:49 +0200, Sheldon Hearn wrote:
> 
> 
> On Tue, 22 Aug 2000 17:38:24 +0200, Andre Albsmeier wrote:
> 
> > Yes. It would work even without testing nfs_client_enable but
> > would probably fail if no NFS support was compiled into the kernel
> 
> I had a look and decided that it's not really important to limit the
> output associated with "starting daemons" to daemon names.  It's
> perfectly acceptable to include output relating to the operation of
> those daemons.  I think. :-)

Well, I always liked the idea of having one word of diagnostics
for each deamon which is easy to parse. So, if something goes
wrong, the error messages directly jump into ones eye (I hope
this can be expressed like this in english). 

I always found the NFS cache timeout thing a bit confusing regarding
to this but this is probably my personal opinion only.

I even don't know why this thing has to be set. The default value
(set in the system) is 60 but as soon as the machine is an NFS
client it gets set to 2. Without being an NFS client it probably
doesn't matter so if 2 is the appropriate value it could be
set to this by default. But this is a different topic...

	-Andre

> 
> However, Bruce Evans' rev 1.46 of src/etc/rc lured me in, and I think
> that something like this might be helpful.
> 
> Bruce, is this what you had in mind?
> 
> Ciao,
> Sheldon.
> 
> Index: rc.network
> ===================================================================
> RCS file: /home/ncvs/src/etc/rc.network,v
> retrieving revision 1.83
> diff -u -d -r1.83 rc.network
> --- rc.network	2000/08/16 23:08:28	1.83
> +++ rc.network	2000/08/22 16:19:20
> @@ -8,6 +8,11 @@
>  # first before contemplating any changes here.  If you do need to change
>  # this file for some reason, we would like to know about it.
>  
> +
> +v_set_sysctl() {
> +	echo -n " '`sysctl -w $1 2>&1`'"
> +}
> +
>  # First pass startup stuff.
>  #
>  network_pass1() {
> @@ -270,85 +275,73 @@
>  	[Yy][Ee][Ss] | '')
>  		;;
>  	*)
> -		echo -n ' tcp extensions=NO'
> -		sysctl -w net.inet.tcp.rfc1323=0 >/dev/null
> +		v_set_sysctl net.inet.tcp.rfc1323=0
>  		;;
>  	esac
>  
>  	case ${icmp_bmcastecho} in
>  	[Yy][Ee][Ss])
> -		echo -n ' broadcast ping responses=YES'
> -		sysctl -w net.inet.icmp.bmcastecho=1 >/dev/null
> +		v_set_sysctl net.inet.icmp.bmcastecho=1
>  		;;
>  	esac
>  
>  	case ${icmp_drop_redirect} in
>  	[Yy][Ee][Ss])
> -		echo -n ' ignore ICMP redirect=YES'
> -		sysctl -w net.inet.icmp.drop_redirect=1 >/dev/null
> +		v_set_sysctl net.inet.icmp.drop_redirect=1
>  		;;
>  	esac
>  
>  	case ${icmp_log_redirect} in
>  	[Yy][Ee][Ss])
> -		echo -n ' log ICMP redirect=YES'
> -		sysctl -w net.inet.icmp.log_redirect=1 >/dev/null
> +		v_set_sysctl net.inet.icmp.log_redirect=1
>  		;;
>  	esac
>  
>  	case ${gateway_enable} in
>  	[Yy][Ee][Ss])
> -		echo -n ' IP gateway=YES'
> -		sysctl -w net.inet.ip.forwarding=1 >/dev/null
> +		v_set_sysctl net.inet.ip.forwarding=1
>  		;;
>  	esac
>  
>  	case ${forward_sourceroute} in
>  	[Yy][Ee][Ss])
> -		echo -n ' do source routing=YES'
> -		sysctl -w net.inet.ip.sourceroute=1 >/dev/null
> +		v_set_sysctl net.inet.ip.sourceroute=1
>  		;;
>  	esac
>  
>  	case ${accept_sourceroute} in
>  	[Yy][Ee][Ss])
> -		echo -n ' accept source routing=YES'
> -		sysctl -w net.inet.ip.accept_sourceroute=1 >/dev/null
> +		v_set_sysctl net.inet.ip.accept_sourceroute=1
>  		;;
>  	esac
>  
>  	case ${tcp_keepalive} in
>  	[Yy][Ee][Ss])
> -		echo -n ' TCP keepalive=YES'
> -		sysctl -w net.inet.tcp.always_keepalive=1 >/dev/null
> +		v_set_sysctl net.inet.tcp.always_keepalive=1
>  		;;
>  	esac
>  
>  	case ${tcp_restrict_rst} in
>  	[Yy][Ee][Ss])
> -		echo -n ' restrict TCP reset=YES'
> -		sysctl -w net.inet.tcp.restrict_rst=1 >/dev/null
> +		v_set_sysctl net.inet.tcp.restrict_rst=1
>  		;;
>  	esac
>  
>  	case ${tcp_drop_synfin} in
>  	[Yy][Ee][Ss])
> -		echo -n ' drop SYN+FIN packets=YES'
> -		sysctl -w net.inet.tcp.drop_synfin=1 >/dev/null
> +		v_set_sysctl net.inet.tcp.drop_synfin=1
>  		;;
>  	esac
>  
>  	case ${ipxgateway_enable} in
>  	[Yy][Ee][Ss])
> -		echo -n ' IPX gateway=YES'
> -		sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null
> +		v_set_sysctl net.ipx.ipx.ipxforwarding=1
>  		;;
>  	esac
>  
>  	case ${arpproxy_all} in
>  	[Yy][Ee][Ss])
> -		echo -n ' ARP proxyall=YES'
> -		sysctl -w net.link.ether.inet.proxyall=1 >/dev/null
> +		v_set_sysctl net.link.ether.inet.proxyall=1
>  		;;
>  	esac
>  
> @@ -356,8 +349,7 @@
>  	[Nn][Oo] | '')
>  		;;
>  	*)
> -		echo -n ' ip_portrange_first=$ip_portrange_first'
> -		sysctl -w net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
> +		v_set_sysctl net.inet.ip.portrange.first=$ip_portrange_first
>  		;;
>  	esac
>  
> @@ -365,8 +357,7 @@
>  	[Nn][Oo] | '')
>  		;;
>  	*)
> -		echo -n ' ip_portrange_last=$ip_portrange_last'
> -		sysctl -w net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
> +		v_set_sysctl net.inet.ip.portrange.last=$ip_portrange_last
>  		;;
>  	esac
>  
> @@ -527,15 +518,14 @@
>  
>  			case ${nfs_reserved_port_only} in
>  			[Yy][Ee][Ss])
> -				echo -n ' NFS on reserved port only=YES'
> -				sysctl -w vfs.nfs.nfs_privport=1 >/dev/null
> +				v_set_sysctl vfs.nfs.nfs_privport=1
>  				;;
>  			esac
>  
>  			echo -n ' nfsd';	nfsd ${nfs_server_flags}
>  
>  			if [ -n "${nfs_bufpackets}" ]; then
> -				sysctl -w vfs.nfs.bufpackets=${nfs_bufpackets} \
> +				v_set_sysctl vfs.nfs.bufpackets=${nfs_bufpackets} \
>  					> /dev/null
>  			fi
>  
> @@ -575,9 +565,7 @@
>  	[Yy][Ee][Ss])
>  		echo -n ' nfsiod';	nfsiod ${nfs_client_flags}
>  		if [ -n "${nfs_access_cache}" ]; then
> -		echo -n " NFS access cache time=${nfs_access_cache}"
> -		sysctl -w vfs.nfs.access_cache_timeout=${nfs_access_cache} \
> -			>/dev/null
> +		v_set_sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache}
>  		fi
>  		;;
>  	esac
> @@ -672,9 +660,8 @@
>  	[Nn][Oo] | '')
>  		;;
>  	*)
> -		echo -n ' log_in_vain=YES'
> -		sysctl -w net.inet.tcp.log_in_vain=1 >/dev/null
> -		sysctl -w net.inet.udp.log_in_vain=1 >/dev/null
> +		v_set_sysctl net.inet.tcp.log_in_vain=1
> +		v_set_sysctl net.inet.udp.log_in_vain=1
>  		;;
>  	esac
>  

-- 
Windows NT Multitasking: Messing up several things at once.
Comment 6 Bruce Evans 2000-08-23 03:14:23 UTC
On Tue, 22 Aug 2000, Sheldon Hearn wrote:

> On Tue, 22 Aug 2000 17:38:24 +0200, Andre Albsmeier wrote:
> 
> > Yes. It would work even without testing nfs_client_enable but
> > would probably fail if no NFS support was compiled into the kernel
> 
> I had a look and decided that it's not really important to limit the
> output associated with "starting daemons" to daemon names.  It's
> perfectly acceptable to include output relating to the operation of
> those daemons.  I think. :-)

In old mail to Andre about this, I said that the daemon-related output
should be together with the daemon names.  Now I think s separate section
is better.  There is too much output to format nicely.

> However, Bruce Evans' rev 1.46 of src/etc/rc lured me in, and I think
                                            rc.network
> that something like this might be helpful.
> 
> Bruce, is this what you had in mind?

Not quite.  I didn't think of your good idea of using a function.  Maybe
the function could format the output nicely (somehow mark up the output
associated with daemons, and wrap lines nicely...).

Bruce
Comment 7 matt 2001-04-05 10:39:35 UTC
What about doing something like this?

1) add a helper function

v_echo_status() {
    echo -n " ['$1']";
}

2) adjust rc output

- echo -n " NFS access cache time=${nfs_access_cache}"
+ v_echo_status "NFS access cache time=${nfs_access_cache}"

which will produce:

nfsiod [NFS access cache time=2]

This intermingles daemon names and their associated status/options, but is
in a format that is easily parseable by humans and machines.

--
Matt Emmerton
Comment 8 Sheldon Hearn freebsd_committer freebsd_triage 2001-11-27 18:43:03 UTC
State Changed
From-To: open->suspended

We'll rethink this one once the rcNG process has settled. 
Right now, it's barely started.
Comment 9 Sheldon Hearn freebsd_committer freebsd_triage 2001-11-27 18:44:21 UTC
Responsible Changed
From-To: sheldonh->dougb

Ugh, forgot to hand this over to dougb, who's overseeing the rcNG 
process and could be considered the startup scripts' maintainer.
Comment 10 Doug Barton freebsd_committer freebsd_triage 2002-04-15 03:36:43 UTC
State Changed
From-To: suspended->closed


While I agree that this isn't as clean as it could be, the 
nfs access cache time is related to the nfs client stuff, 
so it's not totally out of place here. The alternative 
solutions make the code more complicated, for no great 
benefit. 

In the long run, with any kind of luck, all this code is 
going away, so this level of change for little benefit 
doesn't seem justified.