freebsd-skq/sys/fs/tmpfs
alc d27a56b062 Correct an error of omission in the implementation of the truncation
operation on POSIX shared memory objects and tmpfs.  Previously, neither of
these modules correctly handled the case in which the new size of the object
or file was not a multiple of the page size.  Specifically, they did not
handle partial page truncation of data stored on swap.  As a result, stale
data might later be returned to an application.

Interestingly, a data inconsistency was less likely to occur under tmpfs
than POSIX shared memory objects.  The reason being that a different mistake
by the tmpfs truncation operation helped avoid a data inconsistency.  If the
data was still resident in memory in a PG_CACHED page, then the tmpfs
truncation operation would reactivate that page, zero the truncated portion,
and leave the page pinned in memory.  More precisely, the benevolent error
was that the truncation operation didn't add the reactivated page to any of
the paging queues, effectively pinning the page.  This page would remain
pinned until the file was destroyed or the page was read or written.  With
this change, the page is now added to the inactive queue.

Discussed with:	jhb
Reviewed by:	kib (an earlier version)
MFC after:	3 weeks
2012-01-08 20:09:26 +00:00
..
tmpfs_fifoops.c Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs_fifoops.h Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs_subr.c Correct an error of omission in the implementation of the truncation 2012-01-08 20:09:26 +00:00
tmpfs_vfsops.c Don astbestos garment and remove the warning about TMPFS being experimental 2011-11-07 16:21:50 +00:00
tmpfs_vnops.c Don't pass VM_ALLOC_ZERO to vm_page_grab() in tmpfs_mappedwrite() and 2012-01-03 03:29:01 +00:00
tmpfs_vnops.h Reflect license change of NetBSD code. 2008-09-03 18:53:48 +00:00
tmpfs.h Improve the way to calculate available pages in tmpfs: 2011-11-21 20:26:22 +00:00