git: kernel - Close a few SMP holes

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Jul 24 22:01:19 PDT 2016


commit fda4c5f3ee0a939d4eec5cbb125d0944b4529cac
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Jul 24 21:55:00 2016 -0700

    kernel - Close a few SMP holes
    
    * Don't trust the compiler when loading refs in cache_zap().  Make sure
      it doesn't reorder or re-use the memory reference.
    
    * In cache_nlookup() and cache_nlookup_maybe_shared(), do a full re-test
      of the namecache element after locking instead of a partial re-test.
    
    * Lock the namecache record in two situations where we need to set a
      flag.  Almost all other flag cases require similar locking.  This fixes
      a potential SMP race in a very thin window during mounting.
    
    * Fix unmount / access races in sys_vquotactl() and, more importantly, in
      sys_mount().  We were disposing of the namecache record after extracting
      the mount pointer, then using the mount pointer.  This could race an
      unmount and result in a corrupt mount pointer.
    
      Change the code to dispose of the namecache record after we finish using
      the mount point.  This is somewhat more complex then I'd like, but it
      is important to unlock the namecache record across the potentially
      blocking operation to prevent a lock chain from propagating upwards
      towards the root.
    
    * Enhanced debugging for the namecache teardown case when nc_refs changes
      unexpectedly.
    
    * Remove some dead code (cache_purgevfs()).

Summary of changes:
 sys/kern/vfs_cache.c    | 62 ++++++++++++++-----------------------------------
 sys/kern/vfs_conf.c     |  9 ++++++-
 sys/kern/vfs_quota.c    | 31 ++++++++++++++-----------
 sys/kern/vfs_syscalls.c | 37 ++++++++++++++++++++++-------
 4 files changed, 72 insertions(+), 67 deletions(-)

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


-- 
DragonFly BSD source repository



More information about the Commits mailing list