From aa9dd56782a20f5d5a87859acf27f149c9f6ba56 Mon Sep 17 00:00:00 2001 From: avg Date: Tue, 9 Jul 2013 08:47:11 +0000 Subject: 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 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/cddl') diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index d949acb..775fbb4 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -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); -- cgit v1.1