Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 2009 10:10:44 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Scott Long <scottl@samsco.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r188832 - head/sys/nfsclient
Message-ID:  <200902231010.45511.jhb@freebsd.org>
In-Reply-To: <499DF860.8020903@samsco.org>
References:  <200902192218.n1JMI1HF009245@svn.freebsd.org> <499DF860.8020903@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 19 February 2009 7:25:04 pm Scott Long wrote:
> John Baldwin wrote:
> > Author: jhb
> > Date: Thu Feb 19 22:18:00 2009
> > New Revision: 188832
> > URL: http://svn.freebsd.org/changeset/base/188832
> > 
> > Log:
> >   When fetching attributes for a file for NFSv3 mounts, do not perform an
> >   opportunistic ACCESS RPC to populate both the access and attribute 
caches
> >   of the file and instead always use a GETATTR RPC.  On many modern NFS
> >   servers, an ACCESS RPC is much more expensive to service than a GETATTR
> >   RPC.
> >   
> 
> Not too long ago, this was a very useful and important optimization. 
> Can you say which servers this applies to?  Could it have been made an
> option instead of outright deleted?

I know this applies to at least some Net-Apps.  I could certainly restore the 
access priming under a sysctl however.  Something like this:

--- //depot/projects/smpng/sys/nfsclient/nfs_vnops.c	2009/02/20 15:11:39
+++ //depot/user/jhb/lock/nfsclient/nfs_vnops.c	2009/02/23 15:09:16
@@ -208,6 +208,11 @@
 SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
 	   &nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");
 
+static int	nfs_prime_access_cache = 0;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
+	   &nfs_prime_access_cache, 0,
+	   "Prime NFS ACCESS cache when fetching attributes");
+
 static int	nfsv3_commit_on_close = 0;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, nfsv3_commit_on_close, CTLFLAG_RW,
 	   &nfsv3_commit_on_close, 0, "write+commit on close, else only write");
@@ -644,6 +649,12 @@
 	 */
 	if (nfs_getattrcache(vp, &vattr) == 0)
 		goto nfsmout;
+	if (v3 && nfs_prime_access_cache && nfsaccess_cache_timeout > 0) {
+		nfsstats.accesscache_misses++;
+		nfs3_access_otw(vp, NFSV3ACCESS_ALL, td, ap->a_cred);
+		if (nfs_getattrcache(vp, &vattr) == 0)
+			goto nfsmout;
+	}
 	nfsstats.rpccnt[NFSPROC_GETATTR]++;
 	mreq = nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3));
 	mb = mreq;


-- 
John Baldwin



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