open() and ESTALE error

Don Lewis truckman at FreeBSD.org
Fri Jun 20 01:07:13 PDT 2003


On 20 Jun, Andrey Alekseyev wrote:

> In the normal situation, namecache entry+vnode+nfsnode+file handle may
> stay cached for a really long time (until re-used? deleted or renamed
> on the *client*). Expiring file handles (a new mechanism?) means much the
> same to me as simply obtaining a new name cache entry+other data
> on ESTALE :) I may be wrong, though.

One case where there is a difference between timing out old file handles
and just invalidating them on ESTALE:

client%	cmd1 > file1; cmd2 > file2
server% mv file1 tmpfile; mv file2 file1; mv tmpfile file1

wait an hour

client% cat /dev/null > file1

If file handles are cached indefinitely, and the client didn't recycle
the vnode for file1, which file on the server got truncated?  Since
neither file was deleted on the server, you can't rely on ESTALE to
detect this situation.

Question: does the timeout of the directory attributes cause open() do
do an NFS lookup on the file, or does open() just find the vnode in the
cache and use its cached handle?


More information about the freebsd-hackers mailing list