Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Apr 2019 20:47:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 237588] [fusefs] data corruption when mixing normal writes and mmap writes with Write-through cache mode
Message-ID:  <bug-237588-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: asomers@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.

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237588-227>