freebsd-dev/sys
John Baldwin 969bf150df Fix a race condition with concurrent LOOKUP namecache operations for a vnode
not in the namecache when shared lookups are enabled (vfs.lookup_shared=1,
it is currently off by default) and the filesystem supports shared lookups
(e.g. NFS client).  Specifically, if multiple concurrent LOOKUPs both miss
in the name cache in parallel, each of the lookups may each end up adding an
entry to the namecache resulting in duplicate entries in the namecache
for the same pathname.  A subsequent removal of the mapping of that
pathname to that vnode (via remove or rename) would only evict one of the
entries from the name cache.  As a result, subseqent lookups for that
pathname would still return the old vnode.

This race was observed with shared lookups over NFS where a file was updated
by writing a new file out to a temporary file name and then renaming that
temporary file to the "real" file to effect atomic updates of a file.  Other
processes on the same client that were periodically reading the file would
occasionally receive an ESTALE error from open(2) because the VOP_GETATTR()
in nfs_open() would receive that error when given the stale vnode.

The fix here is to check for duplicates in cache_enter() and just return
if an entry for this same directory and leaf file name for this vnode is
already in the cache.  The check for duplicates is done by walking the
per-vnode list of name cache entries.  It is expected that this list should
be very small in the common case (usually 0 or 1 entries during a
cache_enter() since most files only have 1 "leaf" name).

Reviewed by:	ups, scottl
MFC after:	2 months
2008-08-23 15:13:39 +00:00
..
amd64 Adjust the handling the various timer frequencies when using the lapic 2008-08-23 12:35:43 +00:00
arm Provide hooks into the GPIO lines and the ability to set/clear 2008-08-19 22:17:14 +00:00
boot cosmetic changes and style fixes 2008-08-22 20:28:19 +00:00
bsm Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
cam SCSI_DELAY is specified in milliseconds, not seconds. 2008-08-16 21:26:58 +00:00
cddl Add MIPS support. 2008-08-23 04:58:11 +00:00
compat Add comments on NOARGS, NODEF, and NOPROTO. 2008-08-21 22:57:31 +00:00
conf Remove clkbrd(4) as a separate device and compile it solely based 2008-08-23 14:28:44 +00:00
contrib Commit step 1 of the vimage project, (network stack) 2008-08-17 23:27:27 +00:00
crypto Simplify session selection/allocation. 2008-08-09 20:01:01 +00:00
ddb Add a missing include which was erroneusly left out from the previous 2008-08-18 16:51:44 +00:00
dev - Restore the behavior of enabling the MII buffer for an internal 2008-08-23 15:03:26 +00:00
fs Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
gdb
geom Commit step 1 of the vimage project, (network stack) 2008-08-17 23:27:27 +00:00
gnu
i386 If we are unable to obtain a frequency list from either ACPI or the static 2008-08-23 12:53:42 +00:00
ia64 Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
isa
kern Fix a race condition with concurrent LOOKUP namecache operations for a vnode 2008-08-23 15:13:39 +00:00
libkern Add strcspn to libkern for use by xenbus routines. Will add to build 2008-08-15 04:07:22 +00:00
mips Export 'struct pcpu' to userland w/o requiring _KERNEL. A few ports 2008-08-19 19:53:52 +00:00
modules Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
net ifnet_setbyindex() is only used locally, go back to being static. 2008-08-20 05:00:18 +00:00
net80211 Verify that the WPA flags set are actually compatible with the 2008-08-09 05:46:01 +00:00
netatalk
netgraph A bunch of formatting fixes brough to light by, or created by the Vimage commit 2008-08-20 01:05:56 +00:00
netinet Cache the cred locally in _syncache_add() while holding the locks, so 2008-08-23 14:22:12 +00:00
netinet6 Fix some of the formatting fixes.. It's amazing how some thing stand out 2008-08-20 01:24:55 +00:00
netipsec Commit step 1 of the vimage project, (network stack) 2008-08-17 23:27:27 +00:00
netipx
netnatm
netncp
netsmb
nfs
nfs4client
nfsclient Commit step 1 of the vimage project, (network stack) 2008-08-17 23:27:27 +00:00
nfsserver
nlm Fix an interop issue with Linux: If you do nothing but TCP 2008-08-13 12:03:31 +00:00
opencrypto
pc98 Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
pccard
pci Move wb driver from sys/pci to sys/dev/wb. 2008-08-14 21:26:29 +00:00
powerpc Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
rpc Rename the static M_RPC defined here to M_RPCCLNT, since a global M_RPC 2008-08-18 12:11:47 +00:00
security When getaudit(2) is unable to fit the terminal IPv6 address into the 2008-08-23 14:39:01 +00:00
sparc64 Remove clkbrd(4) as a separate device and compile it solely based 2008-08-23 14:28:44 +00:00
sun4v Integrate the new MPSAFE TTY layer to the FreeBSD operating system. 2008-08-20 08:31:58 +00:00
sys Minor style nits. 2008-08-23 01:20:36 +00:00
tools
ufs Revert r181345. 2008-08-10 12:15:36 +00:00
vm Remove unused variable nosleepwithlocks. 2008-08-23 12:40:07 +00:00
xdr
xen - add more debug cruft to xenbus 2008-08-20 09:20:12 +00:00
Makefile Improve the glimpse target: don't index .svn and compile directories. 2008-08-15 14:11:30 +00:00