git: kernel - namecache - fix deadlock

Matthew Dillon dillon at
Thu Dec 31 19:34:13 PST 2009

commit 65870584d7f6f8000fd009bdb787409342fbc995
Author: Matthew Dillon <dillon at>
Date:   Thu Dec 31 19:08:48 2009 -0800

    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.

Summary of changes:
 sys/kern/vfs_cache.c |  136 ++++++++++++++++++++++++++++++++++++++++----------
 sys/kern/vfs_mount.c |    2 +-
 sys/sys/namecache.h  |    4 +-
 3 files changed, 113 insertions(+), 29 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list