opnsense-src/sys/fs/nfsclient
Rick Macklem 847967bc4e nfscl: Fix interaction between mmap'd and VOP_WRITE file updates
asomers@ found a problem with the NFS client, where a write to
an NFS mounted file done via mmap(2) was lost when fspacectl(2)
was done before it.  This turned out to be caused by clearing the
dirty bit on pages when the client was doing commit RPCs,
due to the second argument to vfs_busy_pages() being set to 1.
Commit RPCs tell the server to commit previously written data to
stable storage.  However, Commit RPCs do not write data from the
client to the server.  As such, if the dirty bit on the page has
been set by a mmap'd write to an address in the page, it should
not be cleared.  Clearing it causes the mmap'd write to by lost.

This patch fixes the problem by changing the 2nd argument to
vfs_busy_pages() to 0 for this case.

I doubt this bug has affected many, since it was inherited from
the old NFS client and was in 4.3 FreeBSD twenty years ago.
Although fspacectl(2) is FreeBSD 14 specific, a write(2) would
cause the same failure.

Reviewed by:	kib
Tested by:	asomers
PR:	269328
MFC after:	1 week
2023-02-08 14:25:01 -08:00
..
nfs.h nfscl: Add support for a NFSv4 AppendWrite RPC 2022-04-30 13:49:23 -07:00
nfs_clbio.c filesystems: return error from vn_rlimit_fsize() instead of EFBIG 2022-09-24 19:41:14 +03:00
nfs_clcomsubs.c nfsclient: Fix a typos in source code comments 2022-03-27 19:27:05 +02:00
nfs_clkdtrace.c Adjust dtnfsclient_unload() definition to avoid clang 15 warning 2022-07-19 20:41:24 +02:00
nfs_clkrpc.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
nfs_clnfsiod.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
nfs_clnode.c vfs: add the concept of vnode state transitions 2022-12-26 17:35:12 +00:00
nfs_clport.c nfscl: Improve NFSv4 error message for NFSERR_WRONGSEC 2023-01-11 13:28:44 -08:00
nfs_clrpcops.c nfscl: Fix CreateSession for an established ClientID 2022-07-11 16:50:34 -07:00
nfs_clstate.c nfscl: Move nfsrpc_destroysession into nfscommon 2022-07-09 08:02:14 -07:00
nfs_clsubs.c sysent: Get rid of bogus sys/sysent.h include. 2022-05-28 20:52:17 +03:00
nfs_clvfsops.c nfscl: Allow "nolockd" to work for NFSv4 mounts 2022-09-04 13:09:33 -07:00
nfs_clvnops.c nfscl: Fix interaction between mmap'd and VOP_WRITE file updates 2023-02-08 14:25:01 -08:00
nfs_kdtrace.h fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
nfsmount.h nfscl: Add a VOP_DEALLOCATE() for the NFSv4.2 client 2021-08-27 18:31:36 -07:00
nfsnode.h PR#259071 provides a test program that fails for the NFS client. 2021-10-30 16:35:02 -07:00
nlminfo.h sys/fs: further adoption of SPDX licensing ID tags. 2017-11-27 15:15:37 +00:00