svn commit: r360065 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sat Apr 18 03:07:19 UTC 2020
Author: kib
Date: Sat Apr 18 03:07:18 2020
New Revision: 360065
URL: https://svnweb.freebsd.org/changeset/base/360065
Log:
The pa argument for sendfile_iodone() is not necessary a slice of sfio->pa.
It is true for zfs, but it is not for e.g. vnode or buffer pagers.
When fixing bogus pages, fix them in both places. Rely on the fact
that pa[0] must have been invalid so it cannot be bogus.
Reported and 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 02:53:19 2020 (r360064)
+++ head/sys/kern/kern_sendfile.c Sat Apr 18 03:07:18 2020 (r360065)
@@ -295,10 +295,12 @@ sendfile_iodone(void *arg, vm_page_t *pa, int count, i
* unbusied the swapped-in pages, they can become
* invalid under us.
*/
+ MPASS(count == 0 || pa[0] != bogus_page);
for (i = 0; i < count; i++) {
if (pa[i] == bogus_page) {
- pa[i] = vm_page_relookup(sfio->obj,
- sfio->pindex0 + i + (pa - sfio->pa));
+ sfio->pa[(pa[0]->pindex - sfio->pindex0) + i] =
+ pa[i] = vm_page_relookup(sfio->obj,
+ pa[0]->pindex + i);
KASSERT(pa[i] != NULL,
("%s: page %p[%d] disappeared",
__func__, pa, i));
More information about the svn-src-head
mailing list