Bug 236378

Summary: [FUSEFS] fuse must set FUSE_WRITE_CACHE when writing from the page cache
Product: Base System Reporter: Alan Somers <asomers>
Component: kernAssignee: Alan Somers <asomers>
Status: Closed FIXED    
Severity: Affects Many People CC: cem, emaste
Priority: --- Flags: asomers: mfc-stable12+
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Alan Somers freebsd_committer freebsd_triage 2019-03-07 23:17:27 UTC
FUSE operations all record the pid, uid, and gid of the requesting process.  Many FUSE filesystem daemons use that to authenticate accesses.  Ideally, they would only do it on FUSE_OPEN.  But may daemons are internally stateless, which requires them to authenticate operations on every operation, including FUSE_WRITE.

However, writes that come from the page cache (such as when a fuse-backed file is mmap()ed or when using the writeback caching strategy introduced in protocol 7.23) cannot set these fields correctly, because multiple processes may have written to the same file.  For such cases, FUSE_WRITE defines the FUSE_WRITE_CACHE flag, which indicates to the filesystem daemon that these fields are not valid.

fuse(4) must set this flag when issueing writes from the cache.
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2019-03-07 23:52:31 UTC
Might be more specific to say "fuse should set this flag when the initiating pid/uid/gid is no longer associated with the write."
Comment 2 Alan Somers freebsd_committer freebsd_triage 2019-06-03 17:16:34 UTC
Fixed by r348313