opnsense-src/sys/fs
Konstantin Belousov 555b7bb4c8 Mark pages after EOF as clean after pageout.
Suppose that a file on NFS has partially filled last page, and this
page is dirty.  NFS VOP_PAGEOUT() method only marks the the page clean
up to the block of the last written byte, leaving other blocks dirty.
Also any page which erronously exists in the vnode vm_object past EOF
is also left marked as dirty.

With the introduction of the buf-cache coherent pager, each pass of
syncer over the object with such page results in creation of B_DELWRI
buffer due to VOP_WRITE() call.  This buffer is noted on next syncer
pass, which results e.g. a visible manifestation of shutdown never
finishing vnode sync.  Note that before buf-cache coherency commit, a
dirty page might left never synced to server if a partial writes
occur.

Fix this by clearing dirty bits after EOF.  Only blocks of the partial
page which are completely after EOF are marked clean, to avoid
possible user data loss.

Reported by:	mav
Reviewed by:	alc, markj
Tested by:	mav, pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D11697
2017-07-26 20:07:05 +00:00
..
autofs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
cd9660 Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
cuse Minor code optimisation. 2017-05-31 21:05:24 +00:00
deadfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
devfs Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
ext2fs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fdescfs Replace unnecessary _KERNEL by double-include protection. 2017-07-25 06:59:35 +00:00
fifofs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fuse Complete support for IO_APPEND flag in fuse 2017-06-28 13:56:15 +00:00
msdosfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nandfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nfs Rename vfs.nfsd.enable_uidtostring to vfs.nfs.enable_uidtostring. 2017-07-19 09:59:32 +00:00
nfsclient Mark pages after EOF as clean after pageout. 2017-07-26 20:07:05 +00:00
nfsserver Rename vfs.nfsd.enable_uidtostring to vfs.nfs.enable_uidtostring. 2017-07-19 09:59:32 +00:00
nullfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
procfs remove procfs ctl interface 2017-03-05 03:05:24 +00:00
pseudofs Fix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being 2017-06-27 17:01:46 +00:00
smbfs Mark pages after EOF as clean after pageout. 2017-07-26 20:07:05 +00:00
tmpfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
udf On error, bread(9) zeroes buffer pointer, do not dereference it. 2016-11-22 13:24:57 +00:00
unionfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00