Page MenuHomeFreeBSD

fusefs: fix mmap'd writes in direct_io mode
ClosedPublic

Authored by asomers on Sep 20 2020, 3:15 AM.
Tags
None
Referenced Files
F106084942: D26485.diff
Wed, Dec 25, 3:42 AM
Unknown Object (File)
Nov 10 2024, 6:14 PM
Unknown Object (File)
Oct 17 2024, 4:22 PM
Unknown Object (File)
Oct 3 2024, 8:05 AM
Unknown Object (File)
Oct 3 2024, 12:57 AM
Unknown Object (File)
Oct 2 2024, 3:10 PM
Unknown Object (File)
Sep 27 2024, 2:28 PM
Unknown Object (File)
Sep 26 2024, 12:06 PM
Subscribers

Details

Summary

fusefs: fix mmap'd writes in direct_io mode

If a FUSE server returns FOPEN_DIRECT_IO in response to FUSE_OPEN, that
instructs the kernel to bypass the page cache for that file. This feature
is also known by libfuse's name: "direct_io".

However, when accessing a file via mmap, there is no possible way to bypass
the cache completely. This change fixes a deadlock that would happen when
an mmap'd write tried to invalidate a portion of the cache, wrongly assuming
that a write couldn't possibly come from cache if direct_io were set.

Arguably, we could instead disable mmap for files with FOPEN_DIRECT_IO set.
But allowing it is less likely to cause user complaints, and is more in
keeping with the spirit of open(2), where O_DIRECT instructs the kernel to
"reduce", not "eliminate" cache effects.

PR: 247276

Test Plan

regression test included

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33659
Build 30900: arc lint + arc unit