kernel - Fix namecache leak / broken hysteresis
commit5eeee54a302a9f7e6369aeef740ac702708229f2
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 23 Mar 2018 23:18:22 +0000 (23 16:18 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 23 Mar 2018 23:18:22 +0000 (23 16:18 -0700)
treefe9f5d7ed6e7774d725087ef901e5799f55c2450
parentb09dcccaeca58039d968bfad566c8e27b5c6c2c3
kernel - Fix namecache leak / broken hysteresis

* We were double-using NCF_DESTROYED for both dummy ncp's for
  list iteration and to indicate a removed ncp.  This prevented
  the hysteresis code from properly cleaning up such ncp's.

  Symptoms were growing stalls every few seconds on one cpu as
  the hysteresis code would try to futiley clean up excess
  namecache entries.

* Use NCF_DUMMY instead of NCF_DESTROYED to check for dummy
  list iterators in the hysteresis code, allowing it to process
  NCF_DESTROYED ncps.

* These ncps could accumulate only in situations where the vnode
  nlinks count is greater than 1, since a file deletion when nlinks
  is 1 will delete the vnode and all related ncp's.

  When nlinks is greater than 1, a file entry deletion does not
  necessarily cause the vnode to be deleted, leaving the namecache
  records intact, but flagged NCF_DESTROYED, and prevented the
  hystersis code from operating correctly.

Reported-by: ftigeot
sys/kern/vfs_cache.c
sys/sys/namecache.h