aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-12-04 18:03:46 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-12-17 16:02:41 -0500
commit9b3234b9220aae5387b60bc35a424ab6748b2b59 (patch)
treeeeaf7761a957cd3acdd6c55a91587b28998d0bd9 /fs
parent3a28e331115be5130fe061e6b4183b29385116a6 (diff)
nfsd4: disable zero-copy on non-final read ops
To ensure ordering of read data with any following operations, turn off zero copy if the read is not the final operation in the compound. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4proc.c11
-rw-r--r--fs/nfsd/nfs4state.c8
-rw-r--r--fs/nfsd/xdr4.h8
3 files changed, 19 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index bd67f4d6dfc6..2a2d9b06a413 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -692,6 +692,17 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
692 if (read->rd_offset >= OFFSET_MAX) 692 if (read->rd_offset >= OFFSET_MAX)
693 return nfserr_inval; 693 return nfserr_inval;
694 694
695 /*
696 * If we do a zero copy read, then a client will see read data
697 * that reflects the state of the file *after* performing the
698 * following compound.
699 *
700 * To ensure proper ordering, we therefore turn off zero copy if
701 * the client wants us to do more in this compound:
702 */
703 if (!nfsd4_last_compound_op(rqstp))
704 rqstp->rq_splice_ok = false;
705
695 nfs4_lock_state(); 706 nfs4_lock_state();
696 /* check stateid */ 707 /* check stateid */
697 if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp), 708 if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8e2555112966..8e127b39d323 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1855,14 +1855,6 @@ out_free_session:
1855 goto out; 1855 goto out;
1856} 1856}
1857 1857
1858static bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
1859{
1860 struct nfsd4_compoundres *resp = rqstp->rq_resp;
1861 struct nfsd4_compoundargs *argp = rqstp->rq_argp;
1862
1863 return argp->opcnt == resp->opcnt;
1864}
1865
1866static __be32 nfsd4_map_bcts_dir(u32 *dir) 1858static __be32 nfsd4_map_bcts_dir(u32 *dir)
1867{ 1859{
1868 switch (*dir) { 1860 switch (*dir) {
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 331f8a3277ab..0889bfb43dc9 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -528,6 +528,14 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
528 || nfsd4_is_solo_sequence(resp); 528 || nfsd4_is_solo_sequence(resp);
529} 529}
530 530
531static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
532{
533 struct nfsd4_compoundres *resp = rqstp->rq_resp;
534 struct nfsd4_compoundargs *argp = rqstp->rq_argp;
535
536 return argp->opcnt == resp->opcnt;
537}
538
531#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 539#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
532 540
533static inline void 541static inline void