git: DragonFly_RELEASE_6_2 kernel - Fix namecache issue that can slow systems down over time

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Jan 30 10:53:56 PST 2022


commit b08a681b9d224b8f119d57c04d244457836e47ed
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Jan 30 10:42:11 2022 -0800

    kernel - Fix namecache issue that can slow systems down over time
    
    * Fix a serious dead-record issue with the namecache.
    
      It is very common to create a blah.new file and then rename it over
      an existing file, say, blah.jpg, in order to atomically replace the
      existing file.  Such rename-over operations can cause up to
      (2 * maxvnodes) dead dead namecache records to build up on a
      single hash slot's list.
    
    * Over time, this could result in over a million records on a single
      hash slot's list which is often scanned during namecache lookups,
      causing the kernel to turn into a sludge-pile.
    
      This was not a memory leak per-say, the kernel still cleans excess
      structures (above 2 * maxvnodes) up, but that just maintains the
      status-quo and leaves the system in a slow, poorly-responsive state.
    
    * Fixed by proactively deleting matching dead entries during namecache
      lookups.  The 'live' record is typically at the beginning of the list.
      So to fix, the namecache lookup now scans the list for the hash slot
      backwards and attempts to dispose of dead records.

Summary of changes:
 sys/kern/vfs_cache.c | 84 +++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 70 insertions(+), 14 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/b08a681b9d224b8f119d57c04d244457836e47ed


-- 
DragonFly BSD source repository


More information about the Commits mailing list