cleaning files beyond EOF

Konstantin Belousov kostikbel at gmail.com
Sun Feb 17 05:55:39 UTC 2013


On Sun, Feb 17, 2013 at 11:33:58AM +1100, Bruce Evans wrote:
> I have a (possibly damaged) ffs data block with nonzero data beyond
> EOF.  Is anything responsible for clearing this data when the file
> is mmapped()?
> 
> At least old versions of gcc mmap() the file and have a bug checking
> for EOF.  They read the garbage beyond the end and get confused.

Does the 'damaged' status of the data block mean that it contain the
garbage after EOF on disk ?

UFS uses a small wrapper around vnode_generic_getpages() as the
VOP_GETPAGES(), the wrapping code can be ignored for the current
purpose.

vnode_generic_getpages() iterates over the the pages after the bstrategy()
and marks the part of the page after EOF valid and zeroes it, using
vm_page_set_valid_range().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130217/e4922208/attachment.sig>


More information about the freebsd-fs mailing list