Date: Sat, 18 Apr 2020 03:07:18 +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: r360065 - head/sys/kern Message-ID: <202004180307.03I37IN8059294@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004180307.03I37IN8059294>