git: kernel - add cache_unlink(), fix a rename issue.

Matthew Dillon dillon at
Fri Aug 24 16:31:57 PDT 2012

commit 8d09ad3d0e4543ec320a92a5edf6ea9cbe75ce43
Author: Matthew Dillon <dillon at>
Date:   Fri Aug 24 16:26:31 2012 -0700

    kernel - add cache_unlink(), fix a rename issue.
    * Add a rollup function called cache_unlink() to handle namecache
      effects when unlinking a file.
    * Change namecache semantics a bit.  When a namecache entry is unlinked
      we allow it to be left in the topology as long as the vnode survives,
      but marked NCF_DESTROYED so it does not conflict with any new entries
      that might be named the same, and does not get returned in lookup results.
    * This will solve the issue when renaming a file over an empty directory
      (destroying the directory) when one or more processes are chdir'd into
      that directory.  This would cause the process nchdir stuff to get out
      of sync with the retained directory vnode because the same namecache
      entry would get reused.

Summary of changes:
 sys/kern/vfs_cache.c   |   42 +++++++++++++++++++++++++++++++++---------
 sys/kern/vfs_default.c |    7 ++-----
 sys/kern/vfs_nlookup.c |    6 +++++-
 sys/sys/namecache.h    |    1 +
 4 files changed, 41 insertions(+), 15 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list