Date: Sat, 6 Jun 2020 00:48:00 +0000 (UTC) From: Chuck Silvers <chs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361855 - head/sys/vm Message-ID: <202006060048.0560m09x028351@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: chs Date: Sat Jun 6 00:47:59 2020 New Revision: 361855 URL: https://svnweb.freebsd.org/changeset/base/361855 Log: Don't mark pages as valid if reading the contents from disk fails. Instead, just skip marking pages valid if the read fails. Future attempts to access such pages will notice that they are not marked valid and try to read them from disk again. Reviewed by: kib, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D25138 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Jun 6 00:40:02 2020 (r361854) +++ head/sys/vm/vnode_pager.c Sat Jun 6 00:47:59 2020 (r361855) @@ -1150,28 +1150,30 @@ vnode_pager_generic_getpages_done(struct buf *bp) if (mt == bogus_page) continue; - if (nextoff <= object->un_pager.vnp.vnp_size) { - /* - * Read filled up entire page. - */ - vm_page_valid(mt); - KASSERT(mt->dirty == 0, - ("%s: page %p is dirty", __func__, mt)); - KASSERT(!pmap_page_is_mapped(mt), - ("%s: page %p is mapped", __func__, mt)); - } else { - /* - * Read did not fill up entire page. - * - * Currently we do not set the entire page valid, - * we just try to clear the piece that we couldn't - * read. - */ - vm_page_set_valid_range(mt, 0, - object->un_pager.vnp.vnp_size - tfoff); - KASSERT((mt->dirty & vm_page_bits(0, - object->un_pager.vnp.vnp_size - tfoff)) == 0, - ("%s: page %p is dirty", __func__, mt)); + if (error == 0) { + if (nextoff <= object->un_pager.vnp.vnp_size) { + /* + * Read filled up entire page. + */ + vm_page_valid(mt); + KASSERT(mt->dirty == 0, + ("%s: page %p is dirty", __func__, mt)); + KASSERT(!pmap_page_is_mapped(mt), + ("%s: page %p is mapped", __func__, mt)); + } else { + /* + * Read did not fill up entire page. + * + * Currently we do not set the entire page + * valid, we just try to clear the piece that + * we couldn't read. + */ + vm_page_set_valid_range(mt, 0, + object->un_pager.vnp.vnp_size - tfoff); + KASSERT((mt->dirty & vm_page_bits(0, + object->un_pager.vnp.vnp_size - tfoff)) == + 0, ("%s: page %p is dirty", __func__, mt)); + } } if (i < bp->b_pgbefore || i >= bp->b_npages - bp->b_pgafter)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006060048.0560m09x028351>