freebsd-nq/sys
John Baldwin 8587289fb8 The UFS dirhash code was attempting to update shared state in the dirhash
from multiple threads while holding a shared lock during a lookup operation.
This could result in incorrect ENOENT failures which could then be
permanently stored in the name cache.

Specifically, the dirhash code optimizes the case that a single thread is
walking a directory sequentially opening (or stat'ing) each file.  It uses
state in the dirhash structure to determine if a given lookup is using the
optimization.  If the optimization fails, it disables it and restarts the
lookup.  The problem arises when two threads both attempt the optimization
and fail.  The first thread will restart the loop, but the second thread
will incorrectly think that it did not try the optimization and will only
examine a subset of the directory entires in its hash chain.  As a result,
it may fail to find its directory entry and incorrectly fail with ENOENT.

To make this safe for use with shared locks, simplify the state stored in
the dirhash and move some of the state (the part that determines if the
current thread is trying the optimization) into a local variable.  One
result is that we will now try the optimization more often.  We still
update the value under the shared lock, but it is a single atomic store
similar to i_diroff that is stored in UFS directory i-nodes for the
non-dirhash lookup.

Reviewed by:	kib
MFC after:	1 week
2011-03-07 18:33:29 +00:00
..
amd64 Remove dead code. 2011-03-07 08:12:07 +00:00
arm Continue to introduce Capsicum capability mode: 2011-03-01 13:35:48 +00:00
boot MFi386: revision 219186 2011-03-03 11:45:54 +00:00
bsm Add ECAPMODE, "Not permitted in capability mode", a new kernel errno 2011-03-01 13:14:28 +00:00
cam Don't automatically send a START UNIT to sequential access devices- 2011-03-03 18:28:21 +00:00
cddl Fix libzpool build. 2011-03-06 01:22:14 +00:00
compat Export login class information via kinfo and make it possible to view 2011-03-05 14:41:49 +00:00
conf Add two new system calls, setloginclass(2) and getloginclass(2). This makes 2011-03-05 12:40:35 +00:00
contrib Merge ACPICA 20110211. 2011-02-12 01:03:15 +00:00
crypto Fix a bug in the result of manual assembly. 2011-03-02 14:56:58 +00:00
ddb Modify kdb_trap() so that it re-calls the dbbe_trap function as long as 2011-02-18 22:25:11 +00:00
dev Add some more IDs of HighPoint RocketRAID 64x. 2011-03-06 16:10:39 +00:00
fs Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/ 2011-02-25 10:11:01 +00:00
gdb Modify kdb_trap() so that it re-calls the dbbe_trap function as long as 2011-02-18 22:25:11 +00:00
geom Add the disk ident and a human-meaningful description (here, the disk model 2011-02-26 14:58:54 +00:00
gnu Fix typos - remove duplicate "the". 2011-02-21 09:01:34 +00:00
i386 Continue to introduce Capsicum capability mode: 2011-03-01 13:35:48 +00:00
ia64 Remove pmap fields that are either unused or not fully implemented. 2011-02-17 15:36:29 +00:00
isa
kern The execution of the shebang script requires putting interpreter path, 2011-03-06 22:59:30 +00:00
kgssapi
libkern Fix typos - remove duplicate "is". 2011-02-23 09:22:33 +00:00
mips Increase NKPT in case of n32 and n64 to support more physical memory. 2011-03-01 04:21:56 +00:00
modules Break the keycache management functions out into if_ath_keycache.c . 2011-03-02 17:19:54 +00:00
net Fix a panic that can happen when trying to destroy a lagg(4) with scheduler set to none. 2011-03-04 20:37:38 +00:00
net80211 Fix typos - remove duplicate "is". 2011-02-23 09:22:33 +00:00
netatalk
netgraph Unbreak the build for no options INET6. 2011-03-03 16:16:49 +00:00
netinet Adds a new Congestion Control that helps reduce 2011-03-01 00:37:46 +00:00
netinet6 Fix typos - remove duplicate "the". 2011-02-21 09:01:34 +00:00
netipsec Fixed IPsec's HMAC_SHA256-512 support to be RFC4868 compliant. 2011-02-18 09:40:13 +00:00
netipx
netnatm
netncp
netsmb Change some variables from int to size_t. This is more accurate since 2011-01-08 23:06:54 +00:00
nfs Modify the experimental NFSv4 server so that it posts a SIGUSR2 2011-01-14 23:30:35 +00:00
nfsclient Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/ 2011-02-25 10:11:01 +00:00
nfsserver Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/ 2011-02-25 10:11:01 +00:00
nlm sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly. 2011-01-12 19:54:19 +00:00
opencrypto fixed size of AH_ALEN_MAX, which is 64 bytes for SHA-512. 2011-02-25 09:29:32 +00:00
pc98 Fix typos - remove duplicate "the". 2011-02-21 09:01:34 +00:00
pci Add initial support for RTL8401E PCIe Fast Ethernet. 2011-02-16 21:59:42 +00:00
powerpc Turn off default generation of userland dot symbols on powerpc64 now that 2011-02-18 21:44:53 +00:00
rpc Mfp4 CH=177274,177280,177284-177285,177297,177324-177325 2011-02-16 21:29:13 +00:00
security - Add a FEATURE for capsicum (security_capabilities). 2011-03-04 09:03:54 +00:00
sparc64 - With the addition of TLS support binutils started to make the addend 2011-03-06 15:20:11 +00:00
sun4v Remove pmap fields that are either unused or not fully implemented. 2011-02-17 15:36:29 +00:00
sys Export login class information via kinfo and make it possible to view 2011-03-05 14:41:49 +00:00
teken Use proper bounds checking on VPA. 2010-12-05 10:15:23 +00:00
tools
ufs The UFS dirhash code was attempting to update shared state in the dirhash 2011-03-07 18:33:29 +00:00
vm Change the return type of vmspace_swap_count to a long to match the other 2011-03-01 11:04:30 +00:00
x86 Set C1 "I/O then Halt" capability bit for Intel EIST. Some broken BIOSes 2011-02-25 23:14:24 +00:00
xdr
xen Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier. 2011-01-19 00:57:58 +00:00
Makefile Add lex and yacc sources to things cscope'd. 2010-11-21 03:58:11 +00:00