From: Matthew Dillon Date: Thu, 17 Mar 2005 22:25:46 +0000 (+0000) Subject: Add RCNG support for setting the negative attribute cache timeout, make X-Git-Tag: v2.0.1~8129 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/d615ff4f4eec594a1e0dc2ceaffafbbd1c4551db Add RCNG support for setting the negative attribute cache timeout, make the boot-time display of nfs client parameters more readable, and properly document the nfs_access_cache and nfs_neg_cache RCNG configuration variables. Increase the default NFS attribute cache timeout from 2 to 5 seconds. --- diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 58cf8e9e38..77a0d65e6d 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -14,7 +14,7 @@ # All arguments must be in double or single quotes. # # $FreeBSD: src/etc/defaults/rc.conf,v 1.180 2003/06/26 09:50:50 smkelly Exp $ -# $DragonFly: src/etc/defaults/rc.conf,v 1.21 2005/02/17 22:35:38 liamfoy Exp $ +# $DragonFly: src/etc/defaults/rc.conf,v 1.22 2005/03/17 22:25:44 dillon Exp $ ############################################################## ### Important initial Boot-time options #################### @@ -185,12 +185,17 @@ sshd_flags="" # Additional flags for sshd. ### Network File System (NFS): ### ### Server-side options also need rpcbind_enable="YES" ### +### +### NOTE: attribute cache timeouts only effect NFS lookup rpc's. If +### the mtime matches the data cache is left intact. +### amd_enable="NO" # Run amd service with $amd_flags (or NO). amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map" amd_map_program="NO" # Can be set to "ypcat -k amd.master" nfs_client_enable="NO" # This host is an NFS client (or NO). nfs_client_flags="-n 4" # Flags to nfsiod (if enabled). -nfs_access_cache="2" # Client cache timeout in seconds +nfs_access_cache="5" # Client attribute cache timeout in seconds +#nfs_neg_cache="3" # Client attribute negative hit cache timeout nfs_server_enable="NO" # This host is an NFS server (or NO). nfs_server_flags="-u -t -n 4" # Flags to nfsd (if enabled). mountd_enable="NO" # Run mountd (or NO). diff --git a/etc/rc.d/nfsclient b/etc/rc.d/nfsclient index b30ca7f6ba..08ddce87bd 100644 --- a/etc/rc.d/nfsclient +++ b/etc/rc.d/nfsclient @@ -1,7 +1,7 @@ #!/bin/sh # # $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $ -# $DragonFly: src/etc/rc.d/nfsclient,v 1.4 2004/01/27 00:42:45 rob Exp $ +# $DragonFly: src/etc/rc.d/nfsclient,v 1.5 2005/03/17 22:25:15 dillon Exp $ # # PROVIDE: nfsclient @@ -33,19 +33,24 @@ nfsclient_start() # # Run nfsiod and set some nfs client related sysctls # + echo -n "NFS CLIENT:" if [ -n "${nfs_client_flags}" ]; then echo -n ' nfsiod' nfsiod ${nfs_client_flags} fi if [ -n "${nfs_access_cache}" ]; then - echo "NFS access cache time=${nfs_access_cache}" sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null fi + if [ -n "${nfs_neg_cache}" ]; then + sysctl vfs.nfs.neg_cache_timeout=${nfs_neg_cache} >/dev/null + fi if [ -n "${nfs_bufpackets}" ]; then - sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null + sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null fi - + echo -n " access_cache_timeout=`sysctl -n vfs.nfs.access_cache_timeout`" + echo -n " neg_cache_timeout=`sysctl -n vfs.nfs.neg_cache_timeout`" + echo "" unmount_all } diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 058a84e7b4..e337f2c852 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.197 2003/07/28 13:56:00 mbr Exp $ -.\" $DragonFly: src/share/man/man5/rc.conf.5,v 1.9 2005/02/17 22:44:39 liamfoy Exp $ +.\" $DragonFly: src/share/man/man5/rc.conf.5,v 1.10 2005/03/17 22:25:46 dillon Exp $ .Dd March 3, 2002 .Dt RC.CONF 5 .Os @@ -1169,8 +1169,27 @@ this can be set to to disable NFS ACCESS RPC caching, or to the number of seconds for which NFS ACCESS results should be cached. +A value of 2-10 seconds will substantially reduce network traffic for +many NFS operations. The default is 5 seconds. Note that the attribute +cache holds stat information only. The NFS data cache is independant +of the attribute cache and is only invalidated when the client detects that +the server has modified the underlying file. This value specifies a +maximum timeout. The NFS client will automatically use a shorter timeout +for files which have been recently modified. +.It Va nfs_neg_cache +.Pq Vt int +If +.Va nfs_client_enable +is set to +.Dq Li YES , +this can be set to +.Dq Li 0 +to disable the caching of NEGATIVE LOOKUPS (lookups of non-existant +filenames), or to the number of seconds for which negative lookups should +be cached. A value of 2-10 seconds will substantially reduce network -traffic for many NFS operations. +traffic for many NFS operations, especially source code builds. The +default is 3 seconds. .It Va nfs_server_enable .Pq Vt bool If set to