git: tmpfs - Fix data loss issues
dillon at crater.dragonflybsd.org
Sun Feb 11 08:57:23 PST 2018
Author: Matthew Dillon <dillon at apollo.backplane.com>
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
* 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