Author: avg
Date: Sat Oct 16 19:56:46 2010
New Revision: 213933
URL: http://svn.freebsd.org/changeset/base/213933

Log:
  MFC r213735: tmpfs + sendfile: do not produce partially valid pages for
  vnode's tail

Modified:
  stable/8/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 16 19:53:22 2010        
(r213932)
+++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 16 19:56:46 2010        
(r213933)
@@ -525,6 +525,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 (vm_page_sleep_if_busy(m, FALSE, "tmfsmr"))
                        goto lookupvpg;
                vm_page_busy(m);
@@ -532,9 +534,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;
                }
@@ -542,7 +545,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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to