Skip to content

Commit

Permalink
nfsd: hook nfsd_commit up to the nfsd_file cache
Browse files Browse the repository at this point in the history
Use cached filps if possible instead of opening a new one every time.

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>
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed Aug 19, 2019
1 parent 48cd7b5 commit 5920afa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,9 +1133,9 @@ __be32
nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
loff_t offset, unsigned long count)
{
struct file *file;
loff_t end = LLONG_MAX;
__be32 err = nfserr_inval;
struct nfsd_file *nf;
loff_t end = LLONG_MAX;
__be32 err = nfserr_inval;

if (offset < 0)
goto out;
Expand All @@ -1145,20 +1145,20 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out;
}

err = nfsd_open(rqstp, fhp, S_IFREG,
NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file);
err = nfsd_file_acquire(rqstp, fhp,
NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf);
if (err)
goto out;
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)
err = nfserrno(err2);
else
err = nfserr_notsupp;
}

fput(file);
nfsd_file_put(nf);
out:
return err;
}
Expand Down

0 comments on commit 5920afa

Please sign in to comment.