Fix bugs in the limiting code for negative-hit namecache entries. The system
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 19 Oct 2004 05:55:34 +0000 (05:55 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 19 Oct 2004 05:55:34 +0000 (05:55 +0000)
commit62d0f1f0a7d811e15a1917fed360e51488c2730d
treee8ad46ccb0a09c2e6156d92ef2d2aedf86064f04
parent82342dcec92268a6af1be7c87a96ac1012d520b2
Fix bugs in the limiting code for negative-hit namecache entries.  The system
was allowing too many negative entries to build up.  Since these entries by
definition do not have associated vnodes the vnode code is not responsible
for limiting the number of negative entries.  Since vnodes associated
with non-leaf namecache entries are held, the build-up of negative entries
prevented directory vnodes from being recycled and caused vnlru_proc to fail.

To fix this we check for and cleanup negative entries in both the old API
cache_enter() and the new API cache_nlookup().  Rather then just removing one
when we exceed the limit we remove 10 and we create a 90%/100% hysteresis
to avoid a non-optimal following cleanup call on every cache lookup.

Reported-by: Pawel Biernacki <kaktus@DragonFlyBSD.pl>,
     Chris Pressey <cpressey@catseye.mine.nu>
Testing-by: same
sys/kern/vfs_cache.c
sys/kern/vfs_mount.c
sys/sys/namecache.h