kernel - namecache - fix deadlock
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 1 Jan 2010 03:08:48 +0000 (19:08 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 1 Jan 2010 03:08:48 +0000 (19:08 -0800)
commit65870584d7f6f8000fd009bdb787409342fbc995
tree3252d68225022a9737f9a3e46e77e7d2bdc2ad01
parent196ce81ed1cea0a1326a34d5d13712d6f0dc8ff9
kernel - namecache - fix deadlock

* cache_drop() can be called in numerous situations where unrelated
  vnode or namecache locks are held, particularly in the
  allocfreevnode() path when it calls cache_inval_vp_nonblock().

* If cache_drop() is transitioning a nc_refs from 1 to 0 it will call
  cache_zap() to free the (now untracked) ncp.  Adjust cache_zap() to
  leave the namecache entry alone if a lock on ncp->nc_parent
  cannot be acquired, instead of blocking (and potentially deadlocking).

* Add _cache_cleandefered() (part of cache_hysteresis()) to handle
  any buildup.  It is expensive but the race occurs at a low rate
  under moderate load so it should hardly ever have to be run.
sys/kern/vfs_cache.c
sys/kern/vfs_mount.c
sys/sys/namecache.h