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

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Apr 28 15:18:44 PDT 2022


commit 2d4292df287441e4d32e2a435c501655a9d70c56
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/2d4292df287441e4d32e2a435c501655a9d70c56


-- 
DragonFly BSD source repository


More information about the Commits mailing list