diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2020-04-18 03:09:25 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2020-04-18 03:09:25 +0000 |
commit | acf65eef23ef16b34ce7172b8ffb324a4557cd50 (patch) | |
tree | 81e7a60aad5b16bb11f21bc9f2a29d7c2a31ef23 /sys/kern/kern_sendfile.c | |
parent | e795a04083119a5e0229a676c81f92c828ec747b (diff) |
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
Notes
Notes:
svn path=/head/; revision=360066
Diffstat (limited to 'sys/kern/kern_sendfile.c')
-rw-r--r-- | sys/kern/kern_sendfile.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index e1715fd55afd..0b72df68eee4 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -313,6 +313,24 @@ sendfile_iodone(void *arg, vm_page_t *pa, int count, int error) 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) { |