Date: Tue, 12 Oct 2010 17:16:51 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213735 - head/sys/fs/tmpfs Message-ID: <201010121716.o9CHGp9W054833@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Tue Oct 12 17:16:51 2010 New Revision: 213735 URL: http://svn.freebsd.org/changeset/base/213735 Log: 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 Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 12 17:12:35 2010 (r213734) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Oct 12 17:16:51 2010 (r213735) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010121716.o9CHGp9W054833>