nfsd: hook up nfsd_read to the nfsd_file cache

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Jeff Layton 2019-08-18 14:18:50 -04:00 committed by J. Bruce Fields
parent b493523926
commit 48cd7b5125
1 changed files with 4 additions and 7 deletions

View File

@ -1071,25 +1071,22 @@ out_nfserr:
__be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
loff_t offset, struct kvec *vec, int vlen, unsigned long *count) loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
{ {
struct nfsd_file *nf;
struct file *file; struct file *file;
struct raparms *ra;
__be32 err; __be32 err;
trace_nfsd_read_start(rqstp, fhp, offset, *count); trace_nfsd_read_start(rqstp, fhp, offset, *count);
err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); err = nfsd_file_acquire(rqstp, fhp, NFSD_MAY_READ, &nf);
if (err) if (err)
return err; return err;
ra = nfsd_init_raparms(file); file = nf->nf_file;
if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &rqstp->rq_flags)) if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &rqstp->rq_flags))
err = nfsd_splice_read(rqstp, fhp, file, offset, count); err = nfsd_splice_read(rqstp, fhp, file, offset, count);
else else
err = nfsd_readv(rqstp, fhp, file, offset, vec, vlen, count); err = nfsd_readv(rqstp, fhp, file, offset, vec, vlen, count);
if (ra) nfsd_file_put(nf);
nfsd_put_raparams(file, ra);
fput(file);
trace_nfsd_read_done(rqstp, fhp, offset, *count); trace_nfsd_read_done(rqstp, fhp, offset, *count);