Author: kib
Date: Sat Apr 18 03:09:25 2020
New Revision: 360066
URL: https://svnweb.freebsd.org/changeset/base/360066

Log:
  sendfile: When all io finished, assert that sfio->pa[] is in expected state.
  
  It must contain fully restored contigous run of the wired pages from
  the object, except possible trimmed tail.
  
  Tested by:    pho
  Sponsored by: The FreeBSD Foundation
  MFC after:    2 weeks

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==============================================================================
--- head/sys/kern/kern_sendfile.c       Sat Apr 18 03:07:18 2020        
(r360065)
+++ head/sys/kern/kern_sendfile.c       Sat Apr 18 03:09:25 2020        
(r360066)
@@ -313,6 +313,24 @@ sendfile_iodone(void *arg, vm_page_t *pa, int count, i
        if (!refcount_release(&sfio->nios))
                return;
 
+#ifdef INVARIANTS
+       for (i = 1; i < sfio->npages; i++) {
+               if (sfio->pa[i] == NULL)
+                       break;
+               KASSERT(vm_page_wired(sfio->pa[i]),
+                   ("sfio %p page %d %p not wired", sfio, i, sfio->pa[i]));
+               if (i == 0)
+                       continue;
+               KASSERT(sfio->pa[0]->object == sfio->pa[i]->object,
+                   ("sfio %p page %d %p wrong owner %p %p", sfio, i,
+                   sfio->pa[i], sfio->pa[0]->object, sfio->pa[i]->object));
+               KASSERT(sfio->pa[0]->pindex + i == sfio->pa[i]->pindex,
+                   ("sfio %p page %d %p wrong index %jx %jx", sfio, i,
+                   sfio->pa[i], (uintmax_t)sfio->pa[0]->pindex,
+                   (uintmax_t)sfio->pa[i]->pindex));
+       }
+#endif
+
        vm_object_pip_wakeup(sfio->obj);
 
        if (sfio->m == NULL) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to