mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
nfsd: use vfs_iter_read/write
Instead of messing with the address limit to use vfs_read/vfs_writev. Note that this requires that exported file implement ->read_iter and ->write_iter. All currently exportable file systems do this. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
abbb65899a
commit
73da852e38
1 changed files with 7 additions and 10 deletions
|
@ -911,13 +911,12 @@ __be32 nfsd_splice_read(struct svc_rqst *rqstp,
|
||||||
__be32 nfsd_readv(struct file *file, loff_t offset, struct kvec *vec, int vlen,
|
__be32 nfsd_readv(struct file *file, loff_t offset, struct kvec *vec, int vlen,
|
||||||
unsigned long *count)
|
unsigned long *count)
|
||||||
{
|
{
|
||||||
mm_segment_t oldfs;
|
struct iov_iter iter;
|
||||||
int host_err;
|
int host_err;
|
||||||
|
|
||||||
oldfs = get_fs();
|
iov_iter_kvec(&iter, READ | ITER_KVEC, vec, vlen, *count);
|
||||||
set_fs(KERNEL_DS);
|
host_err = vfs_iter_read(file, &iter, &offset, 0);
|
||||||
host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset, 0);
|
|
||||||
set_fs(oldfs);
|
|
||||||
return nfsd_finish_read(file, count, host_err);
|
return nfsd_finish_read(file, count, host_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,7 +973,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
|
||||||
unsigned long *cnt, int stable)
|
unsigned long *cnt, int stable)
|
||||||
{
|
{
|
||||||
struct svc_export *exp;
|
struct svc_export *exp;
|
||||||
mm_segment_t oldfs;
|
struct iov_iter iter;
|
||||||
__be32 err = 0;
|
__be32 err = 0;
|
||||||
int host_err;
|
int host_err;
|
||||||
int use_wgather;
|
int use_wgather;
|
||||||
|
@ -1000,10 +999,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
|
||||||
if (stable && !use_wgather)
|
if (stable && !use_wgather)
|
||||||
flags |= RWF_SYNC;
|
flags |= RWF_SYNC;
|
||||||
|
|
||||||
/* Write the data. */
|
iov_iter_kvec(&iter, WRITE | ITER_KVEC, vec, vlen, *cnt);
|
||||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
host_err = vfs_iter_write(file, &iter, &pos, flags);
|
||||||
host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, flags);
|
|
||||||
set_fs(oldfs);
|
|
||||||
if (host_err < 0)
|
if (host_err < 0)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
*cnt = host_err;
|
*cnt = host_err;
|
||||||
|
|
Loading…
Reference in a new issue