zfs: try to properly handle i/o errors in mappedread_sf

Unconditionally freeing a page is not good, especially if it is the page
that was wired by the caller.  The checks are picked up from
kern_sendfile.

MFC after:	3 weeks
This commit is contained in:
avg 2013-07-09 08:47:11 +00:00
parent f9d5ea16d3
commit aa9dd56782

View File

@ -546,7 +546,9 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio)
vm_page_io_finish(pp);
vm_page_lock(pp);
if (error) {
vm_page_free(pp);
if (pp->wire_count == 0 && pp->valid == 0 &&
pp->busy == 0 && !(pp->oflags & VPO_BUSY))
vm_page_free(pp);
} else {
pp->valid = VM_PAGE_BITS_ALL;
vm_page_activate(pp);