opnsense-src/sys
Alan Somers 3d721de049 Fix NFS exports of FUSE file systems for big directories
The FUSE protocol does not require that a directory entry's d_off field
outlive the lifetime of its directory's file handle.  Since the NFS
server must reopen the directory on every VOP_READDIR call, that means
it can't pass uio->uio_offset down to the FUSE server.  Instead, it must
read the directory from 0 each time.  It may need to issue multiple
FUSE_READDIR operations until it finds the d_off field that it's looking
for.  That was the intention behind SVN r348209 and r297887, but a logic
bug prevented subsequent FUSE_READDIR operations from ever being issued,
rendering large directories incompletely browseable.

Reviewed by:	rmacklem

(cherry picked from commit d088dc76e1)

fusefs: optimize NFS readdir for FUSE_NO_OPENDIR_SUPPORT

In its lowest common denominator, FUSE does not require that a directory
entry's d_off field is valid outside of the lifetime of the directory's
FUSE file handle.  But since NFS is stateless, it must reopen the
directory on every call to VOP_READDIR.  That means reading the
directory all the way from the first entry.  Not only does this create
an O(n^2) condition for large directories, but it can also result in
incorrect behavior if either:

* The file system _does_ change the d_off field for the last directory
  entry previously seen by NFS, or
* The file system deletes the last directory entry previously seen by
  NFS.

Handily, for file systems that set FUSE_NO_OPENDIR_SUPPORT d_off is
guaranteed to be valid for the lifetime of the directory entry, there is
no need to read the directory from the start.

Reviewed by:	rmacklem

(cherry picked from commit 4a6526d84a)

fusefs: require FUSE_NO_OPENDIR_SUPPORT for NFS exporting

FUSE file systems that do not set FUSE_NO_OPENDIR_SUPPORT do not
guarantee that d_off will be valid after closing and reopening a
directory.  That conflicts with NFS's statelessness, that results in
unresolvable bugs when NFS reads large directories, if:

* The file system _does_ change the d_off field for the last directory
  entry previously returned by VOP_READDIR, or
* The file system deletes the last directory entry previously seen by
  NFS.

Rather than doing a poor job of exporting such file systems, it's better
just to refuse.

Even though this is technically a breaking change, 13.0-RELEASE's
NFS-FUSE support was bad enough that an MFC should be allowed.

Reviewed by:	rmacklem
Differential Revision: https://reviews.freebsd.org/D33726

(cherry picked from commit 00134a0789)

fusefs: fix the build without INVARIANTS after 00134a0789

MFC with:	00134a0789
Reported by:	se

(cherry picked from commit 18ed2ce77a)
2022-03-02 16:35:33 -07:00
..
amd64 ed: Remove options 2022-02-22 11:44:56 -07:00
arm sched: separate out schedinit_ap() 2022-02-10 14:55:29 -06:00
arm64 Stop single stepping in signal handers on arm64 2022-02-22 16:23:07 +00:00
bsm
cam Fix non-printable characters in NVMe model and serial numbers. 2022-02-18 16:28:32 -05:00
cddl fbt: Remove handling for CTFv1 2022-03-02 08:59:16 -05:00
compat LinuxKPI: update 802.11 headers 2022-02-27 23:41:54 +00:00
conf cxgbe(4): Update firmwares to 1.26.6.0. 2022-02-27 22:48:07 -08:00
contrib iwlwifi: update firmware 2022-02-27 23:41:55 +00:00
crypto Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
ddb
dev cxgbe(4): Changes to the fatal error handler. 2022-03-02 14:08:33 -08:00
dts add overlay for enabling i2c1 on allwinner h3 2022-02-09 11:35:59 +02:00
fs Fix NFS exports of FUSE file systems for big directories 2022-03-02 16:35:33 -07:00
gdb gdb(4): Do not use run length encoding for 3-symbol repetitions 2022-02-04 20:58:34 -05:00
geom geom: add kqfilter support for geom dev 2022-02-23 08:26:49 -09:00
gnu
i386 ed: Remove options 2022-02-22 11:44:56 -07:00
isa
kern posixshm: Allow jails to use kern.ipc.posix_shm_list 2022-03-02 15:08:00 -08:00
kgssapi
libkern Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
mips sched: separate out schedinit_ap() 2022-02-10 14:55:29 -06:00
modules cxgbe(4): Update firmwares to 1.26.6.0. 2022-02-27 22:48:07 -08:00
net bridge: Don't share broadcast packets 2022-02-28 16:38:05 +01:00
net80211 net80211: enhance (disabled) debugging 2022-02-20 16:24:57 +00:00
netgraph ng pppoe(4): Add the required NET_EPOCH section to the hook 2022-02-13 15:05:45 +03:00
netinet netinet: allow UDP tunnels to be removed 2022-02-28 16:38:05 +01:00
netinet6 MFC 2290dfb40f: 2022-02-25 14:49:33 -05:00
netipsec syncache: accept packet with no SA when TCP_MD5SIG is set 2022-02-10 10:31:33 -09:00
netpfil pf: fix set_prio after nv conversion 2022-02-21 10:18:24 +01:00
netsmb
nfs nfs: don't truncate directory cookies to 32-bits in the NFS server 2022-01-02 20:09:15 -07:00
nfsclient
nfsserver
nlm
ofed socket: Rename sb(un)lock() and interlock with listen(2) 2021-10-07 09:56:47 -04:00
opencrypto Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
powerpc powerpc: Fix syntax atomic.h 2022-03-02 14:08:33 -08:00
riscv cxgbe(4): Changes to the fatal error handler. 2022-03-02 14:08:33 -08:00
rpc rpc: Delete AUTH_NEEDS_TLS(_MUTUAL_HOST) auth_stat values 2021-12-29 17:23:30 -08:00
security Thread creation privilege for realtime group 2021-12-19 04:42:52 +02:00
sys mbuf: make M_ASSERT_NO_SND_TAG() as strict as other similar asserts 2022-02-25 10:57:10 +01:00
teken
tests routing: add IPv6 fib validation procedure. 2021-09-07 21:02:58 +00:00
tools Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2022-02-08 15:00:55 -05:00
ufs ufs: handle LoR between snap lock and vnode lock 2022-02-15 16:01:23 -08:00
vm vm_pageout: Print a more accurate message to the console before an OOM kill 2022-02-28 09:06:58 -05:00
x86 Wait longer for a previous IPI to be sent 2022-03-02 15:56:30 -06:00
xdr
xen xen(4): Fix a common typo in a source code comments 2022-02-09 07:20:31 +01:00
Makefile