nfscl: Fix IO_APPEND writes from kernel space

Commit 867c27c23a modified the NFS client so that
it did IO_APPEND writes directly to the NFS server
bypassing the buffer cache, via a call to
nfs_directio_write().  Unfortunately, this (very old)
function assumed that the uio iov was for user space
addresses.  As such, a IO_APPEND VOP_WRITE() that
was for system space, such as ktrace(1) does, would
write bogus data.

This patch fixes nfs_directio_write() so that it
handles kernel space uio iovs.

Reported by:	bz
Tested by:	bz
MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2022-03-28 15:11:52 -07:00
parent f5138631fb
commit c1970a7eba

View File

@ -780,7 +780,7 @@ nfs_directio_write(vp, uiop, cred, ioflag)
uio.uio_iovcnt = 1;
uio.uio_offset = uiop->uio_offset;
uio.uio_resid = size;
uio.uio_segflg = UIO_USERSPACE;
uio.uio_segflg = uiop->uio_segflg;
uio.uio_rw = UIO_WRITE;
uio.uio_td = td;
iomode = NFSWRITE_FILESYNC;