git: kernel - check nc_generation in nlookup path

Matthew Dillon dillon at
Sun Jul 3 22:28:40 PDT 2022

commit 417b10864204d0b13caea9c2d7bc7f35c004600a
Author: Matthew Dillon <dillon at>
Date:   Sun Jul 3 20:47:32 2022 -0700

    kernel - check nc_generation in nlookup path
    * With nc_generation now operating in a more usable manner, we can
      use it in nlookup() to check for changes.  When a change is detected,
      the related lock will be cycled and the entire nlookup() will retry up
      to debug.nlookup_max_retries, which currently defaults to 4.
    * Add debugging via debug.nlookup_debug.  Set to 3 for nc_generation
    * Move "Parent directory lost" kprintfs into a debugging conditional,
      reported via (debug.nlookup_debug & 4).
    * This fixes lookup/remove races which could sometimes cause open()
      and other system calls to return EINVAL or ENOTCONN.  Basically
      what happened was that nlookup() wound up on a NCF_DESTROYED entry.
    * A few minutes worth of a dsynth bulk does not report any random
      generation number mismatches or retries, so the code in this commit
      is probably very close to correct.

Summary of changes:
 sys/kern/vfs_cache.c    |  39 ++++++---
 sys/kern/vfs_nlookup.c  | 229 +++++++++++++++++++++++++++++++++++-------------
 sys/kern/vfs_syscalls.c |  10 ++-
 sys/kern/vfs_vnops.c    |   3 +
 sys/sys/namecache.h     |   2 +-
 5 files changed, 210 insertions(+), 73 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list