git: hammer2 - Fix issue where deleted files sometimes linger until umount (2)

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Apr 28 13:36:03 PDT 2022


commit bc8993d7ec542748734a1e2cd7a3998b6984b255
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Apr 28 12:52:46 2022 -0700

    hammer2 - Fix issue where deleted files sometimes linger until umount (2)
    
    This is related to the issue of having to retain the inodes for deleted
    files that still have live references.  Even though their nlinks has
    dropped to 0, such inodes must be retained and be fully operational
    until the last live reference goes away.  When that reference DOES
    go away, we need to dispose of the inode as quickly as possible.
    
    * The last fix wasn't good enough.  Some vnodes still linger for
      indefinite periods of time after a rm -rf.  In addition, the last
      fix attempted to clean-out inodes that might have still had dirty
      buffers associated with the vnode.
    
    * Fall-back to the method that UFS and HAMMER1 use, which is to obtain a
      full ref on ip->vp using vget() (or similar) that we can cycle to force
      the vnode to be inactivated.
    
      This also entails using the inode lock in the inactive/reclaim path
      to interlock the ip->vp accesss, unfortunately.
    
      The vnode buffers and inode are now cleaned up in the inactivation
      path (when nlinks is 0) instead of the reclaim path.
    
    * Validated against a (roughly) 20 million inode distfile unpack and
      another few million inodes created via grok processing.
    
    * Add a vfs support function in the kernel called vfinalize() which
      operates on a referenced vnode.  This function flags the vnode
      for immediate deactivation when the last ref is released.

Summary of changes:
 sys/kern/vfs_lock.c             |  16 +++++
 sys/sys/vnode.h                 |   1 +
 sys/vfs/hammer2/hammer2.h       |   3 +-
 sys/vfs/hammer2/hammer2_inode.c | 127 +++++++++++++++++++---------------------
 sys/vfs/hammer2/hammer2_vnops.c | 109 +++++++++++++++++++---------------
 5 files changed, 139 insertions(+), 117 deletions(-)

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


-- 
DragonFly BSD source repository


More information about the Commits mailing list