freebsd-dev/sys/fs/fuse
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
..
fuse_device.c fusefs: don't leak memory of unsent operations on unmount 2019-06-28 18:48:02 +00:00
fuse_file.c fusefs: remove superfluous counter_u64_zero 2019-08-06 00:50:25 +00:00
fuse_file.h [skip ci] update copyright headers in fusefs files 2019-06-28 04:18:10 +00:00
fuse_internal.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse_internal.h fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse_io.c fusefs: fix mmap'd writes in direct_io mode 2020-09-24 16:27:53 +00:00
fuse_io.h [skip ci] update copyright headers in fusefs files 2019-06-28 04:18:10 +00:00
fuse_ipc.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse_ipc.h fusefs: add a intr/nointr mount option 2019-07-18 17:55:13 +00:00
fuse_kernel.h fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse_main.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (8 of many) 2020-02-24 10:33:51 +00:00
fuse_node.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse_node.h fusefs: avoid cache corruption with buggy fuse servers 2020-03-11 04:29:45 +00:00
fuse_vfsops.c vfs: remove the thread argument from vget 2020-08-16 17:18:54 +00:00
fuse_vnops.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
fuse.h [skip ci] update copyright headers in fusefs files 2019-06-28 04:18:10 +00:00