diff options
author | jhb <jhb@FreeBSD.org> | 2008-08-23 15:13:39 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-08-23 15:13:39 +0000 |
commit | 6c646c3b72351b43a250c74275bb44d3a0b20ada (patch) | |
tree | 51575aaf4ef8534a1b81dad22155e1e1b4b55567 /sys/sparc64 | |
parent | 6455ebee9c843f7f41b7e66ee9afac730bd349d3 (diff) | |
download | FreeBSD-src-6c646c3b72351b43a250c74275bb44d3a0b20ada.zip FreeBSD-src-6c646c3b72351b43a250c74275bb44d3a0b20ada.tar.gz |
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
Diffstat (limited to 'sys/sparc64')
0 files changed, 0 insertions, 0 deletions