]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
nfsd4: disable zero-copy on non-final read ops
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 4 Dec 2012 23:03:46 +0000 (18:03 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 17 Dec 2012 21:02:41 +0000 (16:02 -0500)
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>
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/nfsd/xdr4.h

index bd67f4d6dfc614b4008dbbe9f45649458f5d9148..2a2d9b06a4133eda974a0a78f24c7b7fc8297a23 100644 (file)
@@ -692,6 +692,17 @@ nfsd4_read(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        if (read->rd_offset >= OFFSET_MAX)
                return nfserr_inval;
 
+       /*
+        * If we do a zero copy read, then a client will see read data
+        * that reflects the state of the file *after* performing the
+        * following compound.
+        *
+        * To ensure proper ordering, we therefore turn off zero copy if
+        * the client wants us to do more in this compound:
+        */
+       if (!nfsd4_last_compound_op(rqstp))
+               rqstp->rq_splice_ok = false;
+
        nfs4_lock_state();
        /* check stateid */
        if ((status = nfs4_preprocess_stateid_op(SVC_NET(rqstp),
index 8e25551129662313cbc432b163f3480ce56739d9..8e127b39d3231f084c6030345ad11a222401c6d7 100644 (file)
@@ -1855,14 +1855,6 @@ out_free_session:
        goto out;
 }
 
-static bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
-{
-       struct nfsd4_compoundres *resp = rqstp->rq_resp;
-       struct nfsd4_compoundargs *argp = rqstp->rq_argp;
-
-       return argp->opcnt == resp->opcnt;
-}
-
 static __be32 nfsd4_map_bcts_dir(u32 *dir)
 {
        switch (*dir) {
index 331f8a3277ab1596ab302c0356a1e67cd25a439c..0889bfb43dc9ac83bcf6d05c47c5752dbec5e280 100644 (file)
@@ -528,6 +528,14 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
                || nfsd4_is_solo_sequence(resp);
 }
 
+static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
+{
+       struct nfsd4_compoundres *resp = rqstp->rq_resp;
+       struct nfsd4_compoundargs *argp = rqstp->rq_argp;
+
+       return argp->opcnt == resp->opcnt;
+}
+
 #define NFS4_SVC_XDRSIZE               sizeof(struct nfsd4_compoundargs)
 
 static inline void