Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Apr 2020 03:09:25 +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: r360066 - head/sys/kern
Message-ID:  <202004180309.03I39P7e059437@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



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