OSDN Git Service

NFS COPY xdr handle async reply
authorOlga Kornievskaia <kolga@netapp.com>
Mon, 9 Jul 2018 19:13:30 +0000 (15:13 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 9 Aug 2018 16:56:38 +0000 (12:56 -0400)
If server returns async reply, it must include a callback stateid,
wr_callback_id in the write_response4.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs42xdr.c
include/linux/nfs_xdr.h

index 09a540d..205c356 100644 (file)
@@ -389,21 +389,23 @@ static int decode_write_response(struct xdr_stream *xdr,
                                 struct nfs42_write_res *res)
 {
        __be32 *p;
+       int status, count;
 
-       p = xdr_inline_decode(xdr, 4 + 8 + 4);
+       p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-
-       /*
-        * We never use asynchronous mode, so warn if a server returns
-        * a stateid.
-        */
-       if (unlikely(*p != 0)) {
-               pr_err_once("%s: server has set unrequested "
-                               "asynchronous mode\n", __func__);
+       count = be32_to_cpup(p);
+       if (count > 1)
                return -EREMOTEIO;
+       else if (count == 1) {
+               status = decode_opaque_fixed(xdr, &res->stateid,
+                               NFS4_STATEID_SIZE);
+               if (unlikely(status))
+                       goto out_overflow;
        }
-       p++;
+       p = xdr_inline_decode(xdr, 8 + 4);
+       if (unlikely(!p))
+               goto out_overflow;
        p = xdr_decode_hyper(p, &res->count);
        res->verifier.committed = be32_to_cpup(p);
        return decode_verifier(xdr, &res->verifier.verifier);
index 85e928a..06ddfa3 100644 (file)
@@ -1391,6 +1391,7 @@ struct nfs42_copy_args {
 };
 
 struct nfs42_write_res {
+       nfs4_stateid            stateid;
        u64                     count;
        struct nfs_writeverf    verifier;
 };