[Bug 237588] [fusefs] data corruption when mixing normal writes and mmap writes with Write-through cache mode

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Apr 26 20:48:04 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237588

            Bug ID: 237588
           Summary: [fusefs] data corruption when mixing normal writes and
                    mmap writes with Write-through cache mode
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: asomers at FreeBSD.org

fusefs supports three cache modes: uncached, write-through, and writeback. 
Write-through is the default.  However, as currently implemented it's more like
"write-around" than true "write-through".  That is, writes go directly to the
fuse daemon and invalidate the cache, rather than fill it.

This is merely a performance bug when using normal writes (write(2), pwrite(2),
aio_write(2), etc).  But when mixing normal writes with mmap()'ed writes, it
causes data corruption.  The sequence goes like this:
1) A process mmaps a fusefs file
2) That process writes some data, but does not msync() it.
3) A process writes directly, such as with write(2) to a region of the file
that overlaps what was written in step 2.  fusefs invalidates all cached pages
that were part of the write.
4) If any bytes were written by step 2 and invalidated but not written by step
3, then they will be lost.

Steps to reproduce:
==================
1) Build the passthrough example from sysutils/libfuse and fsx from
tools/regression/fsx
2) mkdir -p /tmp/mnt
3) /path/to/libfuse/build/example/passthrough -d /tmp/mnt
4) /path/to/fsx/fsx -P /tmp -S1333 -b5 -N 15 -U fsx.bin

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list