Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 2013 10:11:39 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255566 - head/sys/vm
Message-ID:  <201309141011.r8EABdwo032234@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Sep 14 10:11:38 2013
New Revision: 255566
URL: http://svnweb.freebsd.org/changeset/base/255566

Log:
  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

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Sat Sep 14 10:11:09 2013	(r255565)
+++ head/sys/vm/vm_page.c	Sat Sep 14 10:11:38 2013	(r255566)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309141011.r8EABdwo032234>