Author: glebius
Date: Wed Jan  4 22:31:09 2017
New Revision: 311338
URL: https://svnweb.freebsd.org/changeset/base/311338

Log:
  Fix assertion that checks that pages are consecutive to properly
  handle bogus_page insertion(s).

Modified:
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vnode_pager.c
==============================================================================
--- head/sys/vm/vnode_pager.c   Wed Jan  4 22:29:00 2017        (r311337)
+++ head/sys/vm/vnode_pager.c   Wed Jan  4 22:31:09 2017        (r311338)
@@ -974,10 +974,14 @@ vnode_pager_generic_getpages(struct vnod
 #ifdef INVARIANTS
        KASSERT(bp->b_npages <= nitems(bp->b_pages),
            ("%s: buf %p overflowed", __func__, bp));
-       for (int j = 1; j < bp->b_npages; j++)
-               KASSERT(bp->b_pages[j]->pindex - 1 ==
-                   bp->b_pages[j - 1]->pindex,
-                   ("%s: pages array not consecutive, bp %p", __func__, bp));
+       for (int j = 1, prev = 1; j < bp->b_npages; j++) {
+               if (bp->b_pages[j] == bogus_page)
+                       continue;
+               KASSERT(bp->b_pages[j]->pindex - bp->b_pages[prev]->pindex ==
+                   j - prev, ("%s: pages array not consecutive, bp %p",
+                    __func__, bp));
+               prev = j;
+       }
 #endif
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to