Commit 16f8f894 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: Allow nfsd_vfs_write() to take the nfsd_file as an argument

Needed in order to fix stable writes.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 90d2f1da
...@@ -1021,7 +1021,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -1021,7 +1021,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
&write->wr_head, write->wr_buflen); &write->wr_head, write->wr_buflen);
WARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec)); WARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec));
status = nfsd_vfs_write(rqstp, &cstate->current_fh, nf->nf_file, status = nfsd_vfs_write(rqstp, &cstate->current_fh, nf,
write->wr_offset, rqstp->rq_vec, nvecs, &cnt, write->wr_offset, rqstp->rq_vec, nvecs, &cnt,
write->wr_how_written); write->wr_how_written);
nfsd_file_put(nf); nfsd_file_put(nf);
......
...@@ -947,10 +947,11 @@ static int wait_for_concurrent_writes(struct file *file) ...@@ -947,10 +947,11 @@ static int wait_for_concurrent_writes(struct file *file)
} }
__be32 __be32
nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf,
loff_t offset, struct kvec *vec, int vlen, loff_t offset, struct kvec *vec, int vlen,
unsigned long *cnt, int stable) unsigned long *cnt, int stable)
{ {
struct file *file = nf->nf_file;
struct svc_export *exp; struct svc_export *exp;
struct iov_iter iter; struct iov_iter iter;
__be32 nfserr; __be32 nfserr;
...@@ -1057,7 +1058,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -1057,7 +1058,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
if (err) if (err)
goto out; goto out;
err = nfsd_vfs_write(rqstp, fhp, nf->nf_file, offset, vec, err = nfsd_vfs_write(rqstp, fhp, nf, offset, vec,
vlen, cnt, stable); vlen, cnt, stable);
nfsd_file_put(nf); nfsd_file_put(nf);
out: out:
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
struct nfsd_file;
/* /*
* Callback function for readdir * Callback function for readdir
*/ */
...@@ -93,7 +95,7 @@ __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, ...@@ -93,7 +95,7 @@ __be32 nfsd_read(struct svc_rqst *, struct svc_fh *,
__be32 nfsd_write(struct svc_rqst *, struct svc_fh *, loff_t, __be32 nfsd_write(struct svc_rqst *, struct svc_fh *, loff_t,
struct kvec *, int, unsigned long *, int); struct kvec *, int, unsigned long *, int);
__be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp,
struct file *file, loff_t offset, struct nfsd_file *nf, loff_t offset,
struct kvec *vec, int vlen, unsigned long *cnt, struct kvec *vec, int vlen, unsigned long *cnt,
int stable); int stable);
__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
......
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