kernel - add cache_unlink(), fix a rename issue.
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Aug 2012 23:26:31 +0000 (16:26 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Aug 2012 23:26:31 +0000 (16:26 -0700)
commit8d09ad3d0e4543ec320a92a5edf6ea9cbe75ce43
tree670766f16e59ac9591bb9635ba342246bc76a0a1
parentdcece5c7521207769edc2756956f76ef8b485ce1
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.
sys/kern/vfs_cache.c
sys/kern/vfs_default.c
sys/kern/vfs_nlookup.c
sys/sys/namecache.h