diff options
author | Jeff Layton <jeff.layton@primarydata.com> | 2019-08-18 14:18:51 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2019-08-19 11:00:40 -0400 |
commit | 5920afa3c85ff38642f652b6e3880e79392fcc89 (patch) | |
tree | fd8ea9c530dde77222512d7b82d778c055116be2 /fs/nfsd/vfs.c | |
parent | 48cd7b51258c1a158293cefb97dda988080f5e13 (diff) |
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: 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>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 8593c6423336..ec254bff1893 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1133,9 +1133,9 @@ __be32 | |||
1133 | nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | 1133 | nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, |
1134 | loff_t offset, unsigned long count) | 1134 | loff_t offset, unsigned long count) |
1135 | { | 1135 | { |
1136 | struct file *file; | 1136 | struct nfsd_file *nf; |
1137 | loff_t end = LLONG_MAX; | 1137 | loff_t end = LLONG_MAX; |
1138 | __be32 err = nfserr_inval; | 1138 | __be32 err = nfserr_inval; |
1139 | 1139 | ||
1140 | if (offset < 0) | 1140 | if (offset < 0) |
1141 | goto out; | 1141 | goto out; |
@@ -1145,12 +1145,12 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1145 | goto out; | 1145 | goto out; |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | err = nfsd_open(rqstp, fhp, S_IFREG, | 1148 | err = nfsd_file_acquire(rqstp, fhp, |
1149 | NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &file); | 1149 | NFSD_MAY_WRITE|NFSD_MAY_NOT_BREAK_LEASE, &nf); |
1150 | if (err) | 1150 | if (err) |
1151 | goto out; | 1151 | goto out; |
1152 | if (EX_ISSYNC(fhp->fh_export)) { | 1152 | if (EX_ISSYNC(fhp->fh_export)) { |
1153 | int err2 = vfs_fsync_range(file, offset, end, 0); | 1153 | int err2 = vfs_fsync_range(nf->nf_file, offset, end, 0); |
1154 | 1154 | ||
1155 | if (err2 != -EINVAL) | 1155 | if (err2 != -EINVAL) |
1156 | err = nfserrno(err2); | 1156 | err = nfserrno(err2); |
@@ -1158,7 +1158,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1158 | err = nfserr_notsupp; | 1158 | err = nfserr_notsupp; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | fput(file); | 1161 | nfsd_file_put(nf); |
1162 | out: | 1162 | out: |
1163 | return err; | 1163 | return err; |
1164 | } | 1164 | } |