git: tmpfs - Fix data loss issues

Matthew Dillon dillon at
Sun Feb 11 08:57:23 PST 2018

commit a1b829f26cc7a233e4b9acf03ea71c2379ec8f64
Author: Matthew Dillon <dillon at>
Date:   Sat Feb 10 22:18:19 2018 -0800

    tmpfs - Fix data loss issues
    * Fix a data loss issue that can occur when vnodes are cycled.  This
      can be replicated by setting kern.maxvnodes to a fairly low value.
      Vnode recycling does not necessarily issue a vinvalbuf() when clean
      pages are present, which tmpfs needs to retain.
    * Fix a data loss issue when swap becomes full or when the system has
      no swap configured.  When tmpfs tries to flush to swap and fails,
      pages can remain associated with the vnode after the vinvalbuf()
      call, and then lost when the vnode is recycled.
    * The above fixes are accomplished by call vinvalbuf() on vnode deactivation
      to make sure that all buffers have been flushed, and then moving any
      pages that remain to tn_aobj.
      The pages are moved back when the vnode is reinstantiated and an open(),
      read(), write(), or setattr (i.e.  truncation or extension) is called.
      We try to avoid moving the pages back if the vnode is merely *stat()d
      or deleted.
    * Use cluster_read() by default to try to improve read throughput when
      pages are swap-backed.
    Reported-by: zrj, marino

Summary of changes:
 sys/vfs/tmpfs/tmpfs.h       |  20 +++----
 sys/vfs/tmpfs/tmpfs_subr.c  |  11 ++--
 sys/vfs/tmpfs/tmpfs_vnops.c | 133 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 146 insertions(+), 18 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list