summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-10-12 17:16:51 +0000
committeravg <avg@FreeBSD.org>2010-10-12 17:16:51 +0000
commitf7a1d6d2b8525c5cf9ce426f1e5e88ec25facc4d (patch)
treec0f44b83a845fbdc336eabd29f393f3e828e5130 /sys/fs/tmpfs
parent3bb689aafadf915d572fd946e9403fd922773fe0 (diff)
downloadFreeBSD-src-f7a1d6d2b8525c5cf9ce426f1e5e88ec25facc4d.zip
FreeBSD-src-f7a1d6d2b8525c5cf9ce426f1e5e88ec25facc4d.tar.gz
tmpfs + sendfile: do not produce partially valid pages for vnode's tail
See r213730 for details of analogous change in ZFS. MFC after: 3 days
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index f1768320..059a790 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -538,6 +538,8 @@ lookupvpg:
VM_OBJECT_UNLOCK(vobj);
return (error);
} else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) {
+ KASSERT(offset == 0,
+ ("unexpected offset in tmpfs_mappedread for sendfile"));
if ((m->oflags & VPO_BUSY) != 0) {
/*
* Reference the page before unlocking and sleeping so
@@ -553,9 +555,10 @@ lookupvpg:
sched_pin();
sf = sf_buf_alloc(m, SFB_CPUPRIVATE);
ma = (char *)sf_buf_kva(sf);
- error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen,
- ma + offset);
+ error = tmpfs_nocacheread_buf(tobj, idx, 0, tlen, ma);
if (error == 0) {
+ if (tlen != PAGE_SIZE)
+ bzero(ma + tlen, PAGE_SIZE - tlen);
uio->uio_offset += tlen;
uio->uio_resid -= tlen;
}
@@ -563,7 +566,7 @@ lookupvpg:
sched_unpin();
VM_OBJECT_LOCK(vobj);
if (error == 0)
- vm_page_set_valid(m, offset, tlen);
+ m->valid = VM_PAGE_BITS_ALL;
vm_page_wakeup(m);
VM_OBJECT_UNLOCK(vobj);
return (error);
OpenPOWER on IntegriCloud