freebsd-skq/sys/nfsclient
John Baldwin 12ac99dc46 Close a race with caching of -ve name lookups in the NFS client.
Specifically, clients only trust -ve cache entries while the directory
remains unchanged and discard any -ve cache entries for a directory when
they notice that the modification time of a directory entry changes.  The
race involves two concurrent lookups as follows:
- Thread A does a lookup for file 'foo' which sends a lookup RPC to the
  server.  The lookup fails and the server replies.
- The 'foo' file is created (either by the same client or a different
  client) updating the modification time on the parent directory of 'foo'.
- Thread B does a lookup for a different file 'bar' which updates the
  cached attributes of the parent directory of 'foo' to reflect the new
  modification time after 'foo' was created.
- Thread A finally resumes execution to parse the reply from the NFS
  server.  It adds a -ve cache entry and sets the cached value of the
  directory's modification time that is used for invalidating -ve cached
  lookups to the new modification time set by thread B.

At this point, future lookups of 'foo' will honor the -ve cached entry
until the cached entry is pushed out of the name cache's LRU or the
modification time of the parent directory is changed again by some other
change.  The fix is to read the directory's modification time before
sending the lookup RPC and use that cached modification time when setting
the directory's cached modification time.  Also, we do not add a -ve cache
entry if another thread has added -ve cache entry that set the directory's
cached modification time to a newer value than the value we read before
sending the lookup RPC.

Reviewed by:	rmacklem
MFC after:	1 week
2009-10-16 19:30:48 +00:00
..
bootp_subr.c Rework global locks for interface list and index management, correcting 2009-08-23 20:40:19 +00:00
krpc_subr.c Remove the old kernel RPC implementation and the NFS_LEGACYRPC option. 2009-06-30 19:03:27 +00:00
krpc.h
nfs_bio.c Use PBDRY flag for msleep(9) in NFS and NLM when sleeping thread owns 2009-07-14 22:54:29 +00:00
nfs_diskless.c Merge the remainder of kern_vimage.c and vimage.h into vnet.c and 2009-08-01 19:26:27 +00:00
nfs_kdtrace.c Add a MODULE_DEPEND() on the NFS client from dtnfsclient so that dtnfsclient 2009-10-12 18:58:42 +00:00
nfs_kdtrace.h Fix two bugs in DTrace tracing of accesscache and attrcache load events: 2009-03-24 23:16:48 +00:00
nfs_krpc.c Adjust the internal NFS KPI to avoid the last traces of NFS_LEGACYRPC. 2009-06-30 19:10:17 +00:00
nfs_lock.c Remove the old kernel RPC implementation and the NFS_LEGACYRPC option. 2009-06-30 19:03:27 +00:00
nfs_lock.h
nfs_nfsiod.c Remove the old kernel RPC implementation and the NFS_LEGACYRPC option. 2009-06-30 19:03:27 +00:00
nfs_node.c Add LK_NOWITNESS to the vn_lock() calls done on newly created nfs 2009-09-09 20:37:49 +00:00
nfs_subs.c In nfs_upgrade_vnlock(), assert that the vnode is locked. It is for all 2009-08-14 10:59:17 +00:00
nfs_vfsops.c Reverting the previous change for now. Some users reports the patch 2009-09-15 22:09:42 +00:00
nfs_vnops.c Close a race with caching of -ve name lookups in the NFS client. 2009-10-16 19:30:48 +00:00
nfs.h Adjust the internal NFS KPI to avoid the last traces of NFS_LEGACYRPC. 2009-06-30 19:10:17 +00:00
nfsargs.h
nfsdiskless.h consolidate parsing of nfs root mount options in one place 2006-12-06 02:15:25 +00:00
nfsm_subs.h Remove the old kernel RPC implementation and the NFS_LEGACYRPC option. 2009-06-30 19:03:27 +00:00
nfsmount.h Use PBDRY flag for msleep(9) in NFS and NLM when sleeping thread owns 2009-07-14 22:54:29 +00:00
nfsnode.h Remove the unmaintained University of Michigan NFSv4 client from 8.x 2009-05-22 12:35:12 +00:00
nfsstats.h
nlminfo.h