freebsd-skq/sys
Alan Somers a62772a78e 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
Reported by:	trapexit@spawn.link
Reviewed by:	cem
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26485
2020-09-24 16:27:53 +00:00
..
amd64 Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
arm Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
arm64 Clean up the arm64 bus_dma_run_filter 2020-09-24 10:42:28 +00:00
bsm bsm: add AUE_CLOSERANGE 2020-04-24 01:27:25 +00:00
cam mmc_da: universally use uint8_t for the partition index 2020-09-08 06:19:23 +00:00
cddl loader: zfs should support bootonce an nextboot 2020-09-21 09:01:10 +00:00
compat Do not leak oldvmspace if image activation failed 2020-09-23 18:03:07 +00:00
conf Use envvar rather than nonstandard hint. lines 2020-09-23 19:18:53 +00:00
contrib cache: drop the force flag from purgevfs 2020-09-23 10:46:07 +00:00
crypto Don't return errors from the cryptodev_process() method. 2020-09-08 22:41:35 +00:00
ddb ddb: clean up empty lines in .c and .h files 2020-09-01 22:14:30 +00:00
dev Provide MS() and SM() macros for 80211 and wireless drivers. 2020-09-24 10:57:39 +00:00
dts Remove licenses 2020-06-04 17:20:58 +00:00
fs fusefs: fix mmap'd writes in direct_io mode 2020-09-24 16:27:53 +00:00
gdb gdb(4): Support empty qSupported queries 2020-08-18 20:59:10 +00:00
geom geom_part: make it possible recovering broken GPT after some LBAs cut off 2020-09-17 04:39:39 +00:00
gnu Import DTS files for arm, arm64, riscv from Linux 5.8 2020-08-04 19:44:43 +00:00
i386 Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
isa
kern Fix some signed/unsigned comparison warnings in NFS 2020-09-24 15:38:01 +00:00
kgssapi State kgssapi dependency on xdr. 2020-09-17 22:29:38 +00:00
libkern arm64: check for CRC32 support via HWCAP 2020-09-08 15:39:19 +00:00
mips Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
modules Don't define _STANDALONE when building kernel modules. 2020-09-24 07:10:34 +00:00
net Rework part of routing code to reduce difference to D26449. 2020-09-21 20:02:26 +00:00
net80211 Provide MS() and SM() macros for 80211 and wireless drivers. 2020-09-24 10:57:39 +00:00
netgraph ng_ether: Enter NET_EPOCH where required 2020-09-02 11:49:22 +00:00
netinet Whitespace changes. 2020-09-24 12:26:06 +00:00
netinet6 Rework part of routing code to reduce difference to D26449. 2020-09-21 20:02:26 +00:00
netipsec net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netpfil net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
netsmb net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
nfs nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsclient nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsserver nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nlm nlm: clean up empty lines in .c and .h files 2020-09-01 22:14:52 +00:00
ofed infiniband: Appease Coverty 2020-08-31 16:17:28 +00:00
opencrypto Include sys/types.h here 2020-09-15 15:21:29 +00:00
powerpc Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
riscv Add a vmparam.h constant indicating pmap support for large pages. 2020-09-23 19:34:21 +00:00
rpc Fix a potential memory leak in the NFS over TLS handling code. 2020-09-05 00:50:52 +00:00
security mac_framework.h: fix build with DEBUG_VFS_LOCKS and !MAC 2020-09-03 20:30:52 +00:00
sys Create a standalone version of sys/malloc.h 2020-09-24 06:40:35 +00:00
teken
tests Add small tool to invoke kernel test framework tests. 2020-09-02 09:20:40 +00:00
tools Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions. 2020-09-19 11:06:41 +00:00
ufs Convert page cache read to VOP. 2020-09-15 22:06:36 +00:00
vm Flag vm_reserv and vm_phys sysctls as MPSAFE. 2020-09-23 19:36:07 +00:00
x86 Add missing declarations of 64-bit variants of bus_peek/bus_poke on amd64. 2020-09-24 08:40:32 +00:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen: clean up empty lines in .c and .h files 2020-09-01 21:21:55 +00:00
Makefile