From owner-freebsd-fs Sat Apr 27 18:57:27 2002 Delivered-To: freebsd-fs@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 4DDC737B400; Sat, 27 Apr 2002 18:57:22 -0700 (PDT) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.6) with SMTP id g3S1v7w19999; Sat, 27 Apr 2002 21:57:08 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Sat, 27 Apr 2002 21:57:07 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Brian Candler Cc: freebsd-fs@freebsd.org, freebsd-net@freebsd.org Subject: Re: NFS clearing attribute cache in nfs_open In-Reply-To: <20020426181535.B2748@linnet.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 26 Apr 2002, Brian Candler wrote: > I have been tracing some performance problems on diskless systems. In > particular, the following test program: > > perl -e 'for ($i=0;$i<1000;$i++) { open F,"; close F;}' > > generates 1000 'access' transactions, and hence an exchange of 2000 UDP > packets, just from repeatedly opening the same file. Because access control is performed on the server with NFSv3, not the client, you have to go to the server when you open a file. The attribute cache caches information for stat(), not for evaluation during open(). Although open() might stat the file (vop_getattr()), that's really not the same thing. Try instead a stat() rather than open() and see how the results change in your performance test. Note that an important reason to invoke the NFS RPC for access during open() is that the client may not understand the protection semantics of the server. For example, the server might support ACLs, but the client might not. Or the server might support another access control model of another sort. The return from GETATTR is generally just used for file information rendering as of NFSv3, not actual evaluation. If you cache data for open()'s, you risk problems during a revocation operation. Also, you potentially allow opening files that will become ESTALE, etc. NFSv2/3 isn't really intended to do this sort of caching. You might want to investigate AFS, since AFS tends to perform operations on close() rather than open() once a file is in the cache (and has a "callback" model to invalidate cached files on meta-data changes of this sort). Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message