Commit 5920afa3 authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields

nfsd: hook nfsd_commit up to the nfsd_file cache

Use cached filps if possible instead of opening a new one every time.
Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 48cd7b51
...@@ -1133,7 +1133,7 @@ __be32 ...@@ -1133,7 +1133,7 @@ __be32
nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
loff_t offset, unsigned long count) loff_t offset, unsigned long count)
{ {
struct file *file; struct nfsd_file *nf;
loff_t end = LLONG_MAX; loff_t end = LLONG_MAX;
__be32 err = nfserr_inval; __be32 err = nfserr_inval;
...@@ -1145,12 +1145,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -1145,12 +1145,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out; goto out;
} }
err = nfsd_open(rqstp, fhp, S_IFREG, err = nfsd_file_acquire(rqstp, fhp,
NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file); NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf);
if (err) if (err)
goto out; goto out;
if (EX_ISSYNC(fhp->fh_export)) { if (EX_ISSYNC(fhp->fh_export)) {
int err2 = vfs_fsync_range(file, offset, end, 0); int err2 = vfs_fsync_range(nf->nf_file, offset, end, 0);
if (err2 != -EINVAL) if (err2 != -EINVAL)
err = nfserrno(err2); err = nfserrno(err2);
...@@ -1158,7 +1158,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -1158,7 +1158,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
err = nfserr_notsupp; err = nfserr_notsupp;
} }
fput(file); nfsd_file_put(nf);
out: out:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment