tmpfs, zfs + sendfile: mark page bits as valid after populating it with data

Otherwise, adding insult to injury, in addition to double-caching of data
we would always copy the data into a vnode's vm object page from backend.
This is specific to sendfile case only (VOP_READ with UIO_NOCOPY).

PR:		kern/141305
Reported by:	Wiktor Niesiobedzki <bsd@vink.pl>
Reviewed by:	alc
Tested by:	tools/regression/sockets/sendfile
MFC after:	2 weeks
This commit is contained in:
Andriy Gapon 2010-09-15 10:31:27 +00:00
parent 8518caf2a7
commit 21bd3e2576
2 changed files with 4 additions and 0 deletions

View File

@ -498,6 +498,8 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio)
sched_unpin();
}
VM_OBJECT_LOCK(obj);
if (error == 0)
vm_page_set_valid(m, off, bytes);
vm_page_wakeup(m);
if (error == 0)
uio->uio_resid -= bytes;

View File

@ -562,6 +562,8 @@ tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio
sf_buf_free(sf);
sched_unpin();
VM_OBJECT_LOCK(vobj);
if (error == 0)
vm_page_set_valid(m, offset, tlen);
vm_page_wakeup(m);
VM_OBJECT_UNLOCK(vobj);
return (error);