1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

If the last page of the file is partially full and whole valid

portion is invalidated, invalidate the whole page.  Otherwise,
partially valid page appears on a page queue, which is wrong.  This
could only happen for the last page, because only then buffer which
triggered invalidation could not cover the whole page.

Reported and tested by:	pho (previous version)
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
Approved by:	re (delphij)
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2013-09-14 10:11:38 +00:00
parent 77e306c5e0
commit 196beb5359
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255566

View File

@ -2980,12 +2980,19 @@ void
vm_page_set_invalid(vm_page_t m, int base, int size)
{
vm_page_bits_t bits;
vm_object_t object;
VM_OBJECT_ASSERT_WLOCKED(m->object);
bits = vm_page_bits(base, size);
object = m->object;
VM_OBJECT_ASSERT_WLOCKED(object);
if (object->type == OBJT_VNODE && base == 0 && IDX_TO_OFF(m->pindex) +
size >= object->un_pager.vnp.vnp_size)
bits = VM_PAGE_BITS_ALL;
else
bits = vm_page_bits(base, size);
if (m->valid == VM_PAGE_BITS_ALL && bits != 0)
pmap_remove_all(m);
KASSERT(!pmap_page_is_mapped(m),
KASSERT((bits == 0 && m->valid == VM_PAGE_BITS_ALL) ||
!pmap_page_is_mapped(m),
("vm_page_set_invalid: page %p is mapped", m));
m->valid &= ~bits;
m->dirty &= ~bits;