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 15a92d2..ac53d3e 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 @@ -499,6 +499,8 @@ again: * but it pessimize performance of sendfile/UFS, that's * why I handle this special case in ZFS code. */ + KASSERT(off == 0, + ("unexpected offset in mappedread for sendfile")); if ((m->oflags & VPO_BUSY) != 0) { /* * Reference the page before unlocking and @@ -524,9 +526,12 @@ again: error = dmu_read(os, zp->z_id, start + off, bytes, (void *)(va + off), DMU_READ_PREFETCH); + if (off + bytes != PAGE_SIZE) + bzero(va + off + bytes, + PAGE_SIZE - off - bytes); zfs_unmap_page(sf); } VM_OBJECT_LOCK(obj); if (error == 0) - vm_page_set_valid(m, off, bytes); + m->valid = VM_PAGE_BITS_ALL; vm_page_wakeup(m);