git: kernel - TMPFS - Bug fixing pass

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Feb 13 00:03:47 PST 2010


commit 9fc94b5f0ece4794f4f859f149d8f61883bccf70
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Feb 12 19:15:21 2010 -0800

    kernel - TMPFS - Bug fixing pass
    
    * TMPFS_ASSERT_ELOCKED() is called in numerous places where
      tn_vnode is not necessarily assigned, for example during
      tmpfs_nremove() after the directory entry has been cleaned out.
    
      Remove the assertion that tn_vnode != NULL.
    
    * Add tmpfs_mount->tm_flags and TMPFS_FLAG_UNMOUNTING, used during
      unmounting to tell tmpfs_fsync() to throw away the contents of
      the file (normally it ignores it).  This fixes a panic on umount
      when the main kernel checks that all dirty buffers have been
      cleaned out.
    
    * Fix two places where the wrong length for a string is
      being kmalloc()'d.  The softlink and the directory entry
      string allocations were wrong and resulted in a string
      terminator being stuffed beyond the end of the malloced
      buffer.
    
    * Do a safety-NULL-out of a few fields after kfree()ing them.
    
    * Refactor tmpfs_dir_lookup() a little.
    
    * Enhance tmpfs_reg_resize() to also resize the SWAP VM object.
      Failing to do so can leave extranious swap assignments for
      deleted areas of the file which become visible again (instead
      of becoming zero-fill) if the file is then later ftruncate()d
      larger.
    
      Also fix the block size parameters to nvtruncbuf() and nvextendbuf().
      It must match the block size used for the buffer cache.
    
    * Temporarily turn off all the MPSAFE flags.  Run under the BGL.
    
    * The buffer offset (offset) in tmpfs_read() and tmpfs_write()
      can be a size_t.  It does not have to be off_t.
    
    * tmpfs_write() was using getblk().  It actually has to use bread()
      in order to ensure that the buffer contents is valid when potentially
      doing a piecemeal write which does not cover the whole buffer.
    
    * Refactor tmpfs_write() to leave the underlying VM pages dirty,
      except in cases the system page daemon wants to flush pages to
      clear space in ram (IO_SYNC, IO_ASYNC).  Use buwrite() to do this.
    
    * Fix an error path in tmpfs_strategy() which was not biodone()ing
      the bio.
    
    * tmpfs_remove() was making assumptions with regards to v->a_nch.ncp->nc_vp
      which were not correct.  The vp is not referenced and can get ripped
      out from under the caller unless properly handled.
    
    * Fix sequencing in tmpfs_inactive().  If tn_links is 0 and the node
      is not in the middle of being allocated we can destroy it.
    
    * Remove unnecessary vnode locks from tmpfs_reclaim().  There are also other
      vnode locks scattered around that aren't needed (for another time).
    
    * Implement vop_bmap(), it is basically a dummy.

Summary of changes:
 sys/vfs/tmpfs/tmpfs.h        |    6 ++-
 sys/vfs/tmpfs/tmpfs_subr.c   |   49 +++++++++++----
 sys/vfs/tmpfs/tmpfs_vfsops.c |    8 ++-
 sys/vfs/tmpfs/tmpfs_vnops.c  |  137 +++++++++++++++++++++++++++++-------------
 4 files changed, 140 insertions(+), 60 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/9fc94b5f0ece4794f4f859f149d8f61883bccf70


-- 
DragonFly BSD source repository





More information about the Commits mailing list