Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
[safe/jmp/linux-2.6] / fs / nfs / nfs4xdr.c
index b0d690c..e437fd6 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/time.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <linux/utsname.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/in.h>
 #include <linux/proc_fs.h>
 #include <linux/kdev_t.h>
 #include <linux/sunrpc/clnt.h>
+#include <linux/sunrpc/msg_prot.h>
 #include <linux/nfs.h>
 #include <linux/nfs4.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_idmap.h>
 #include "nfs4_fs.h"
+#include "internal.h"
 
 #define NFSDBG_FACILITY                NFSDBG_XDR
 
@@ -135,7 +136,7 @@ static int nfs4_stat_to_errno(int);
 #define decode_lookup_maxsz    (op_decode_hdr_maxsz)
 #define encode_share_access_maxsz \
                                (2)
-#define encode_createmode_maxsz        (1 + encode_attrs_maxsz)
+#define encode_createmode_maxsz        (1 + encode_attrs_maxsz + encode_verifier_maxsz)
 #define encode_opentype_maxsz  (1 + encode_createmode_maxsz)
 #define encode_claim_null_maxsz        (1 + nfs4_name_maxsz)
 #define encode_open_maxsz      (op_encode_hdr_maxsz + \
@@ -300,6 +301,8 @@ static int nfs4_stat_to_errno(int);
                                XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4)
 #define decode_sequence_maxsz  (op_decode_hdr_maxsz + \
                                XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5)
+#define encode_reclaim_complete_maxsz  (op_encode_hdr_maxsz + 4)
+#define decode_reclaim_complete_maxsz  (op_decode_hdr_maxsz + 4)
 #else /* CONFIG_NFS_V4_1 */
 #define encode_sequence_maxsz  0
 #define decode_sequence_maxsz  0
@@ -677,6 +680,25 @@ static int nfs4_stat_to_errno(int);
                                         decode_sequence_maxsz + \
                                         decode_putrootfh_maxsz + \
                                         decode_fsinfo_maxsz)
+#define NFS4_enc_reclaim_complete_sz   (compound_encode_hdr_maxsz + \
+                                        encode_sequence_maxsz + \
+                                        encode_reclaim_complete_maxsz)
+#define NFS4_dec_reclaim_complete_sz   (compound_decode_hdr_maxsz + \
+                                        decode_sequence_maxsz + \
+                                        decode_reclaim_complete_maxsz)
+
+const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH +
+                                     compound_encode_hdr_maxsz +
+                                     encode_sequence_maxsz +
+                                     encode_putfh_maxsz +
+                                     encode_getattr_maxsz) *
+                                    XDR_UNIT);
+
+const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH +
+                                    compound_decode_hdr_maxsz +
+                                    decode_sequence_maxsz +
+                                    decode_putfh_maxsz) *
+                                   XDR_UNIT);
 #endif /* CONFIG_NFS_V4_1 */
 
 static const umode_t nfs_type2fmt[] = {
@@ -1141,6 +1163,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
 static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
 {
        __be32 *p;
+       struct nfs_client *clp;
 
        p = reserve_space(xdr, 4);
        switch(arg->open_flags & O_EXCL) {
@@ -1149,8 +1172,23 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
                encode_attrs(xdr, arg->u.attrs, arg->server);
                break;
        default:
-               *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
-               encode_nfs4_verifier(xdr, &arg->u.verifier);
+               clp = arg->server->nfs_client;
+               if (clp->cl_minorversion > 0) {
+                       if (nfs4_has_persistent_session(clp)) {
+                               *p = cpu_to_be32(NFS4_CREATE_GUARDED);
+                               encode_attrs(xdr, arg->u.attrs, arg->server);
+                       } else {
+                               struct iattr dummy;
+
+                               *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1);
+                               encode_nfs4_verifier(xdr, &arg->u.verifier);
+                               dummy.ia_valid = 0;
+                               encode_attrs(xdr, &dummy, arg->server);
+                       }
+               } else {
+                       *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
+                       encode_nfs4_verifier(xdr, &arg->u.verifier);
+               }
        }
 }
 
@@ -1593,6 +1631,19 @@ static void encode_destroy_session(struct xdr_stream *xdr,
        hdr->nops++;
        hdr->replen += decode_destroy_session_maxsz;
 }
+
+static void encode_reclaim_complete(struct xdr_stream *xdr,
+                                   struct nfs41_reclaim_complete_args *args,
+                                   struct compound_hdr *hdr)
+{
+       __be32 *p;
+
+       p = reserve_space(xdr, 8);
+       *p++ = cpu_to_be32(OP_RECLAIM_COMPLETE);
+       *p++ = cpu_to_be32(args->one_fs);
+       hdr->nops++;
+       hdr->replen += decode_reclaim_complete_maxsz;
+}
 #endif /* CONFIG_NFS_V4_1 */
 
 static void encode_sequence(struct xdr_stream *xdr,
@@ -2097,7 +2148,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
        encode_compound_hdr(&xdr, req, &hdr);
        encode_sequence(&xdr, &args->seq_args, &hdr);
        encode_putfh(&xdr, args->fh, &hdr);
-       replen = hdr.replen + nfs4_fattr_bitmap_maxsz + 1;
+       replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1;
        encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr);
 
        xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
@@ -2421,6 +2472,26 @@ static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p,
        encode_nops(&hdr);
        return 0;
 }
+
+/*
+ * a RECLAIM_COMPLETE request
+ */
+static int nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, uint32_t *p,
+                                    struct nfs41_reclaim_complete_args *args)
+{
+       struct xdr_stream xdr;
+       struct compound_hdr hdr = {
+               .minorversion = nfs4_xdr_minorversion(&args->seq_args)
+       };
+
+       xdr_init_encode(&xdr, &req->rq_snd_buf, p);
+       encode_compound_hdr(&xdr, req, &hdr);
+       encode_sequence(&xdr, &args->seq_args, &hdr);
+       encode_reclaim_complete(&xdr, args, &hdr);
+       encode_nops(&hdr);
+       return 0;
+}
+
 #endif /* CONFIG_NFS_V4_1 */
 
 static void print_overflow_msg(const char *func, const struct xdr_stream *xdr)
@@ -2437,7 +2508,7 @@ static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       *len = be32_to_cpup(p++);
+       *len = be32_to_cpup(p);
        p = xdr_inline_decode(xdr, *len);
        if (unlikely(!p))
                goto out_overflow;
@@ -2456,14 +2527,14 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
        if (unlikely(!p))
                goto out_overflow;
        hdr->status = be32_to_cpup(p++);
-       hdr->taglen = be32_to_cpup(p++);
+       hdr->taglen = be32_to_cpup(p);
 
        p = xdr_inline_decode(xdr, hdr->taglen + 4);
        if (unlikely(!p))
                goto out_overflow;
        hdr->tag = (char *)p;
        p += XDR_QUADLEN(hdr->taglen);
-       hdr->nops = be32_to_cpup(p++);
+       hdr->nops = be32_to_cpup(p);
        if (unlikely(hdr->nops < 1))
                return nfs4_stat_to_errno(hdr->status);
        return 0;
@@ -2488,7 +2559,7 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
                                opnum, expected);
                return -EIO;
        }
-       nfserr = be32_to_cpup(p++);
+       nfserr = be32_to_cpup(p);
        if (nfserr != NFS_OK)
                return nfs4_stat_to_errno(nfserr);
        return 0;
@@ -2519,7 +2590,7 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       bmlen = be32_to_cpup(p++);
+       bmlen = be32_to_cpup(p);
 
        bitmap[0] = bitmap[1] = 0;
        p = xdr_inline_decode(xdr, (bmlen << 2));
@@ -2528,7 +2599,7 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
        if (bmlen > 0) {
                bitmap[0] = be32_to_cpup(p++);
                if (bmlen > 1)
-                       bitmap[1] = be32_to_cpup(p++);
+                       bitmap[1] = be32_to_cpup(p);
        }
        return 0;
 out_overflow:
@@ -2543,7 +2614,7 @@ static inline int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen,
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       *attrlen = be32_to_cpup(p++);
+       *attrlen = be32_to_cpup(p);
        *savep = xdr->p;
        return 0;
 out_overflow:
@@ -2574,7 +2645,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *type = be32_to_cpup(p++);
+               *type = be32_to_cpup(p);
                if (*type < NF4REG || *type > NF4NAMEDATTR) {
                        dprintk("%s: bad type %d\n", __func__, *type);
                        return -EIO;
@@ -2601,7 +2672,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, change);
+               xdr_decode_hyper(p, change);
                bitmap[0] &= ~FATTR4_WORD0_CHANGE;
                ret = NFS_ATTR_FATTR_CHANGE;
        }
@@ -2625,7 +2696,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, size);
+               xdr_decode_hyper(p, size);
                bitmap[0] &= ~FATTR4_WORD0_SIZE;
                ret = NFS_ATTR_FATTR_SIZE;
        }
@@ -2647,7 +2718,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *res = be32_to_cpup(p++);
+               *res = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT;
        }
        dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true");
@@ -2668,7 +2739,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *res = be32_to_cpup(p++);
+               *res = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT;
        }
        dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true");
@@ -2692,7 +2763,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
                if (unlikely(!p))
                        goto out_overflow;
                p = xdr_decode_hyper(p, &fsid->major);
-               p = xdr_decode_hyper(p, &fsid->minor);
+               xdr_decode_hyper(p, &fsid->minor);
                bitmap[0] &= ~FATTR4_WORD0_FSID;
                ret = NFS_ATTR_FATTR_FSID;
        }
@@ -2716,7 +2787,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *res = be32_to_cpup(p++);
+               *res = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME;
        }
        dprintk("%s: file size=%u\n", __func__, (unsigned int)*res);
@@ -2737,7 +2808,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *res = be32_to_cpup(p++);
+               *res = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT;
        }
        dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res);
@@ -2759,7 +2830,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, fileid);
+               xdr_decode_hyper(p, fileid);
                bitmap[0] &= ~FATTR4_WORD0_FILEID;
                ret = NFS_ATTR_FATTR_FILEID;
        }
@@ -2782,7 +2853,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, fileid);
+               xdr_decode_hyper(p, fileid);
                bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
                ret = NFS_ATTR_FATTR_FILEID;
        }
@@ -2805,7 +2876,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL;
        }
        dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res);
@@ -2827,7 +2898,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[0] &= ~FATTR4_WORD0_FILES_FREE;
        }
        dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res);
@@ -2849,7 +2920,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL;
        }
        dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res);
@@ -2868,7 +2939,7 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       n = be32_to_cpup(p++);
+       n = be32_to_cpup(p);
        if (n == 0)
                goto root_path;
        dprintk("path ");
@@ -2925,7 +2996,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       n = be32_to_cpup(p++);
+       n = be32_to_cpup(p);
        if (n <= 0)
                goto out_eio;
        res->nlocations = 0;
@@ -2936,7 +3007,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               m = be32_to_cpup(p++);
+               m = be32_to_cpup(p);
 
                loc->nservers = 0;
                dprintk("%s: servers ", __func__);
@@ -2994,7 +3065,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE;
        }
        dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res);
@@ -3016,7 +3087,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *maxlink = be32_to_cpup(p++);
+               *maxlink = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_MAXLINK;
        }
        dprintk("%s: maxlink=%u\n", __func__, *maxlink);
@@ -3038,7 +3109,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *maxname = be32_to_cpup(p++);
+               *maxname = be32_to_cpup(p);
                bitmap[0] &= ~FATTR4_WORD0_MAXNAME;
        }
        dprintk("%s: maxname=%u\n", __func__, *maxname);
@@ -3061,7 +3132,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, &maxread);
+               xdr_decode_hyper(p, &maxread);
                if (maxread > 0x7FFFFFFF)
                        maxread = 0x7FFFFFFF;
                *res = (uint32_t)maxread;
@@ -3087,7 +3158,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, &maxwrite);
+               xdr_decode_hyper(p, &maxwrite);
                if (maxwrite > 0x7FFFFFFF)
                        maxwrite = 0x7FFFFFFF;
                *res = (uint32_t)maxwrite;
@@ -3113,7 +3184,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               tmp = be32_to_cpup(p++);
+               tmp = be32_to_cpup(p);
                *mode = tmp & ~S_IFMT;
                bitmap[1] &= ~FATTR4_WORD1_MODE;
                ret = NFS_ATTR_FATTR_MODE;
@@ -3137,7 +3208,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               *nlink = be32_to_cpup(p++);
+               *nlink = be32_to_cpup(p);
                bitmap[1] &= ~FATTR4_WORD1_NUMLINKS;
                ret = NFS_ATTR_FATTR_NLINK;
        }
@@ -3148,7 +3219,8 @@ out_overflow:
        return -EIO;
 }
 
-static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *uid)
+static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap,
+               struct nfs_client *clp, uint32_t *uid, int may_sleep)
 {
        uint32_t len;
        __be32 *p;
@@ -3161,11 +3233,13 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               len = be32_to_cpup(p++);
+               len = be32_to_cpup(p);
                p = xdr_inline_decode(xdr, len);
                if (unlikely(!p))
                        goto out_overflow;
-               if (len < XDR_MAX_NETOBJ) {
+               if (!may_sleep) {
+                       /* do nothing */
+               } else if (len < XDR_MAX_NETOBJ) {
                        if (nfs_map_name_to_uid(clp, (char *)p, len, uid) == 0)
                                ret = NFS_ATTR_FATTR_OWNER;
                        else
@@ -3183,7 +3257,8 @@ out_overflow:
        return -EIO;
 }
 
-static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *gid)
+static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap,
+               struct nfs_client *clp, uint32_t *gid, int may_sleep)
 {
        uint32_t len;
        __be32 *p;
@@ -3196,11 +3271,13 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               len = be32_to_cpup(p++);
+               len = be32_to_cpup(p);
                p = xdr_inline_decode(xdr, len);
                if (unlikely(!p))
                        goto out_overflow;
-               if (len < XDR_MAX_NETOBJ) {
+               if (!may_sleep) {
+                       /* do nothing */
+               } else if (len < XDR_MAX_NETOBJ) {
                        if (nfs_map_group_to_gid(clp, (char *)p, len, gid) == 0)
                                ret = NFS_ATTR_FATTR_GROUP;
                        else
@@ -3234,7 +3311,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
                if (unlikely(!p))
                        goto out_overflow;
                major = be32_to_cpup(p++);
-               minor = be32_to_cpup(p++);
+               minor = be32_to_cpup(p);
                tmp = MKDEV(major, minor);
                if (MAJOR(tmp) == major && MINOR(tmp) == minor)
                        *rdev = tmp;
@@ -3260,7 +3337,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL;
        }
        dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res);
@@ -3282,7 +3359,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE;
        }
        dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res);
@@ -3304,7 +3381,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, res);
+               xdr_decode_hyper(p, res);
                bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL;
        }
        dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res);
@@ -3326,7 +3403,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
                p = xdr_inline_decode(xdr, 8);
                if (unlikely(!p))
                        goto out_overflow;
-               p = xdr_decode_hyper(p, used);
+               xdr_decode_hyper(p, used);
                bitmap[1] &= ~FATTR4_WORD1_SPACE_USED;
                ret = NFS_ATTR_FATTR_SPACE_USED;
        }
@@ -3348,7 +3425,7 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)
        if (unlikely(!p))
                goto out_overflow;
        p = xdr_decode_hyper(p, &sec);
-       nsec = be32_to_cpup(p++);
+       nsec = be32_to_cpup(p);
        time->tv_sec = (time_t)sec;
        time->tv_nsec = (long)nsec;
        return 0;
@@ -3437,7 +3514,7 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c
                goto out_overflow;
        cinfo->atomic = be32_to_cpup(p++);
        p = xdr_decode_hyper(p, &cinfo->before);
-       p = xdr_decode_hyper(p, &cinfo->after);
+       xdr_decode_hyper(p, &cinfo->after);
        return 0;
 out_overflow:
        print_overflow_msg(__func__, xdr);
@@ -3457,7 +3534,7 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
        if (unlikely(!p))
                goto out_overflow;
        supp = be32_to_cpup(p++);
-       acc = be32_to_cpup(p++);
+       acc = be32_to_cpup(p);
        access->supported = supp;
        access->access = acc;
        return 0;
@@ -3525,7 +3602,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       bmlen = be32_to_cpup(p++);
+       bmlen = be32_to_cpup(p);
        p = xdr_inline_decode(xdr, bmlen << 2);
        if (likely(p))
                return 0;
@@ -3616,7 +3693,8 @@ xdr_error:
        return status;
 }
 
-static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, const struct nfs_server *server)
+static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr,
+               const struct nfs_server *server, int may_sleep)
 {
        __be32 *savep;
        uint32_t attrlen,
@@ -3688,12 +3766,14 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons
                goto xdr_error;
        fattr->valid |= status;
 
-       status = decode_attr_owner(xdr, bitmap, server->nfs_client, &fattr->uid);
+       status = decode_attr_owner(xdr, bitmap, server->nfs_client,
+                       &fattr->uid, may_sleep);
        if (status < 0)
                goto xdr_error;
        fattr->valid |= status;
 
-       status = decode_attr_group(xdr, bitmap, server->nfs_client, &fattr->gid);
+       status = decode_attr_group(xdr, bitmap, server->nfs_client,
+                       &fattr->gid, may_sleep);
        if (status < 0)
                goto xdr_error;
        fattr->valid |= status;
@@ -3786,7 +3866,7 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       len = be32_to_cpup(p++);
+       len = be32_to_cpup(p);
        if (len > NFS4_FHSIZE)
                return -EIO;
        fh->size = len;
@@ -3836,7 +3916,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
                fl->fl_pid = 0;
        }
        p = xdr_decode_hyper(p, &clientid);
-       namelen = be32_to_cpup(p++);
+       namelen = be32_to_cpup(p);
        p = xdr_inline_decode(xdr, namelen);
        if (likely(p))
                return -NFS4ERR_DENIED;
@@ -3903,11 +3983,11 @@ static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize)
        limit_type = be32_to_cpup(p++);
        switch (limit_type) {
        case 1:
-               p = xdr_decode_hyper(p, maxsize);
+               xdr_decode_hyper(p, maxsize);
                break;
        case 2:
                nblocks = be32_to_cpup(p++);
-               blocksize = be32_to_cpup(p++);
+               blocksize = be32_to_cpup(p);
                *maxsize = (uint64_t)nblocks * (uint64_t)blocksize;
        }
        return 0;
@@ -3925,7 +4005,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       delegation_type = be32_to_cpup(p++);
+       delegation_type = be32_to_cpup(p);
        if (delegation_type == NFS4_OPEN_DELEGATE_NONE) {
                res->delegation_type = 0;
                return 0;
@@ -3936,7 +4016,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       res->do_recall = be32_to_cpup(p++);
+       res->do_recall = be32_to_cpup(p);
 
        switch (delegation_type) {
        case NFS4_OPEN_DELEGATE_READ:
@@ -3973,7 +4053,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
        if (unlikely(!p))
                goto out_overflow;
        res->rflags = be32_to_cpup(p++);
-       bmlen = be32_to_cpup(p++);
+       bmlen = be32_to_cpup(p);
        if (bmlen > 10)
                goto xdr_error;
 
@@ -4043,7 +4123,7 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_
        if (unlikely(!p))
                goto out_overflow;
        eof = be32_to_cpup(p++);
-       count = be32_to_cpup(p++);
+       count = be32_to_cpup(p);
        hdrlen = (u8 *) p - (u8 *) iov->iov_base;
        recvd = req->rq_rcv_buf.len - hdrlen;
        if (count > recvd) {
@@ -4174,7 +4254,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       len = be32_to_cpup(p++);
+       len = be32_to_cpup(p);
        if (len >= rcvbuf->page_len || len <= 0) {
                dprintk("nfs: server returned giant symlink!\n");
                return -ENAMETOOLONG;
@@ -4301,7 +4381,7 @@ static int decode_setattr(struct xdr_stream *xdr)
        p = xdr_inline_decode(xdr, 4);
        if (unlikely(!p))
                goto out_overflow;
-       bmlen = be32_to_cpup(p++);
+       bmlen = be32_to_cpup(p);
        p = xdr_inline_decode(xdr, bmlen << 2);
        if (likely(p))
                return 0;
@@ -4325,7 +4405,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
                        " %d\n", opnum);
                return -EIO;
        }
-       nfserr = be32_to_cpup(p++);
+       nfserr = be32_to_cpup(p);
        if (nfserr == NFS_OK) {
                p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE);
                if (unlikely(!p))
@@ -4339,7 +4419,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               len = be32_to_cpup(p++);
+               len = be32_to_cpup(p);
                p = xdr_inline_decode(xdr, len);
                if (unlikely(!p))
                        goto out_overflow;
@@ -4348,7 +4428,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
                p = xdr_inline_decode(xdr, 4);
                if (unlikely(!p))
                        goto out_overflow;
-               len = be32_to_cpup(p++);
+               len = be32_to_cpup(p);
                p = xdr_inline_decode(xdr, len);
                if (unlikely(!p))
                        goto out_overflow;
@@ -4410,7 +4490,7 @@ static int decode_exchange_id(struct xdr_stream *xdr,
        p = xdr_inline_decode(xdr, 8);
        if (unlikely(!p))
                goto out_overflow;
-       p = xdr_decode_hyper(p, &clp->cl_ex_clid);
+       xdr_decode_hyper(p, &clp->cl_ex_clid);
        p = xdr_inline_decode(xdr, 12);
        if (unlikely(!p))
                goto out_overflow;
@@ -4418,7 +4498,7 @@ static int decode_exchange_id(struct xdr_stream *xdr,
        clp->cl_exchange_flags = be32_to_cpup(p++);
 
        /* We ask for SP4_NONE */
-       dummy = be32_to_cpup(p++);
+       dummy = be32_to_cpup(p);
        if (dummy != SP4_NONE)
                return -EIO;
 
@@ -4463,7 +4543,7 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
        attrs->max_resp_sz_cached = be32_to_cpup(p++);
        attrs->max_ops = be32_to_cpup(p++);
        attrs->max_reqs = be32_to_cpup(p++);
-       nr_attrs = be32_to_cpup(p++);
+       nr_attrs = be32_to_cpup(p);
        if (unlikely(nr_attrs > 1)) {
                printk(KERN_WARNING "%s: Invalid rdma channel attrs count %u\n",
                        __func__, nr_attrs);
@@ -4504,7 +4584,7 @@ static int decode_create_session(struct xdr_stream *xdr,
        if (unlikely(!p))
                goto out_overflow;
        clp->cl_seqid = be32_to_cpup(p++);
-       session->flags = be32_to_cpup(p++);
+       session->flags = be32_to_cpup(p);
 
        /* Channel attributes */
        status = decode_chan_attrs(xdr, &session->fc_attrs);
@@ -4520,6 +4600,11 @@ static int decode_destroy_session(struct xdr_stream *xdr, void *dummy)
 {
        return decode_op_hdr(xdr, OP_DESTROY_SESSION);
 }
+
+static int decode_reclaim_complete(struct xdr_stream *xdr, void *dummy)
+{
+       return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE);
+}
 #endif /* CONFIG_NFS_V4_1 */
 
 static int decode_sequence(struct xdr_stream *xdr,
@@ -4575,8 +4660,8 @@ static int decode_sequence(struct xdr_stream *xdr,
        dummy = be32_to_cpup(p++);
        /* target highest slot id - currently not processed */
        dummy = be32_to_cpup(p++);
-       /* result flags - currently not processed */
-       dummy = be32_to_cpup(p++);
+       /* result flags */
+       res->sr_status_flags = be32_to_cpup(p);
        status = 0;
 out_err:
        res->sr_status = status;
@@ -4616,7 +4701,8 @@ static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct
        status = decode_open_downgrade(&xdr, res);
        if (status != 0)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4643,7 +4729,8 @@ static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_ac
        status = decode_access(&xdr, res);
        if (status != 0)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4670,7 +4757,8 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lo
                goto out;
        if ((status = decode_getfh(&xdr, res->fh)) != 0)
                goto out;
-       status = decode_getfattr(&xdr, res->fattr, res->server);
+       status = decode_getfattr(&xdr, res->fattr, res->server
+                       ,!RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4694,7 +4782,8 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nf
        if ((status = decode_putrootfh(&xdr)) != 0)
                goto out;
        if ((status = decode_getfh(&xdr, res->fh)) == 0)
-               status = decode_getfattr(&xdr, res->fattr, res->server);
+               status = decode_getfattr(&xdr, res->fattr, res->server,
+                               !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4719,7 +4808,8 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem
                goto out;
        if ((status = decode_remove(&xdr, &res->cinfo)) != 0)
                goto out;
-       decode_getfattr(&xdr, &res->dir_attr, res->server);
+       decode_getfattr(&xdr, &res->dir_attr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4749,11 +4839,13 @@ static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_re
        if ((status = decode_rename(&xdr, &res->old_cinfo, &res->new_cinfo)) != 0)
                goto out;
        /* Current FH is target directory */
-       if (decode_getfattr(&xdr, res->new_fattr, res->server) != 0)
+       if (decode_getfattr(&xdr, res->new_fattr, res->server,
+                               !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
                goto out;
        if ((status = decode_restorefh(&xdr)) != 0)
                goto out;
-       decode_getfattr(&xdr, res->old_fattr, res->server);
+       decode_getfattr(&xdr, res->old_fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4786,11 +4878,13 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link
         * Note order: OP_LINK leaves the directory as the current
         *             filehandle.
         */
-       if (decode_getfattr(&xdr, res->dir_attr, res->server) != 0)
+       if (decode_getfattr(&xdr, res->dir_attr, res->server,
+                               !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
                goto out;
        if ((status = decode_restorefh(&xdr)) != 0)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4819,11 +4913,13 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_cr
                goto out;
        if ((status = decode_getfh(&xdr, res->fh)) != 0)
                goto out;
-       if (decode_getfattr(&xdr, res->fattr, res->server) != 0)
+       if (decode_getfattr(&xdr, res->fattr, res->server,
+                               !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
                goto out;
        if ((status = decode_restorefh(&xdr)) != 0)
                goto out;
-       decode_getfattr(&xdr, res->dir_fattr, res->server);
+       decode_getfattr(&xdr, res->dir_fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4855,7 +4951,8 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_g
        status = decode_putfh(&xdr);
        if (status)
                goto out;
-       status = decode_getfattr(&xdr, res->fattr, res->server);
+       status = decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4962,7 +5059,8 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_clos
         *      an ESTALE error. Shouldn't be a problem,
         *      though, since fattr->valid will remain unset.
         */
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -4994,11 +5092,13 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openr
                goto out;
        if (decode_getfh(&xdr, &res->fh) != 0)
                goto out;
-       if (decode_getfattr(&xdr, res->f_attr, res->server) != 0)
+       if (decode_getfattr(&xdr, res->f_attr, res->server,
+                               !RPC_IS_ASYNC(rqstp->rq_task)) != 0)
                goto out;
        if (decode_restorefh(&xdr) != 0)
                goto out;
-       decode_getfattr(&xdr, res->dir_attr, res->server);
+       decode_getfattr(&xdr, res->dir_attr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -5046,7 +5146,8 @@ static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nf
        status = decode_open(&xdr, res);
        if (status)
                goto out;
-       decode_getfattr(&xdr, res->f_attr, res->server);
+       decode_getfattr(&xdr, res->f_attr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -5073,7 +5174,8 @@ static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_se
        status = decode_setattr(&xdr);
        if (status)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
@@ -5247,7 +5349,8 @@ static int nfs4_xdr_dec_write(struct rpc_rqst *rqstp, __be32 *p, struct nfs_writ
        status = decode_write(&xdr, res);
        if (status)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
        if (!status)
                status = res->count;
 out:
@@ -5276,13 +5379,14 @@ static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, __be32 *p, struct nfs_wri
        status = decode_commit(&xdr, res);
        if (status)
                goto out;
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
 
 /*
- * FSINFO request
+ * Decode FSINFO response
  */
 static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p,
                               struct nfs4_fsinfo_res *res)
@@ -5303,7 +5407,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p,
 }
 
 /*
- * PATHCONF request
+ * Decode PATHCONF response
  */
 static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p,
                                 struct nfs4_pathconf_res *res)
@@ -5324,7 +5428,7 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p,
 }
 
 /*
- * STATFS request
+ * Decode STATFS response
  */
 static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p,
                               struct nfs4_statfs_res *res)
@@ -5345,7 +5449,7 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p,
 }
 
 /*
- * GETATTR_BITMAP request
+ * Decode GETATTR_BITMAP response
  */
 static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res)
 {
@@ -5384,7 +5488,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy)
 }
 
 /*
- * a SETCLIENTID request
+ * Decode SETCLIENTID response
  */
 static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
                struct nfs_client *clp)
@@ -5401,7 +5505,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
 }
 
 /*
- * a SETCLIENTID_CONFIRM request
+ * Decode SETCLIENTID_CONFIRM response
  */
 static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo)
 {
@@ -5421,7 +5525,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str
 }
 
 /*
- * DELEGRETURN request
+ * Decode DELEGRETURN response
  */
 static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res)
 {
@@ -5440,13 +5544,14 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nf
        if (status != 0)
                goto out;
        status = decode_delegreturn(&xdr);
-       decode_getfattr(&xdr, res->fattr, res->server);
+       decode_getfattr(&xdr, res->fattr, res->server,
+                       !RPC_IS_ASYNC(rqstp->rq_task));
 out:
        return status;
 }
 
 /*
- * FS_LOCATIONS request
+ * Decode FS_LOCATIONS response
  */
 static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p,
                                     struct nfs4_fs_locations_res *res)
@@ -5468,14 +5573,15 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p,
                goto out;
        xdr_enter_page(&xdr, PAGE_SIZE);
        status = decode_getfattr(&xdr, &res->fs_locations->fattr,
-                                res->fs_locations->server);
+                                res->fs_locations->server,
+                                !RPC_IS_ASYNC(req->rq_task));
 out:
        return status;
 }
 
 #if defined(CONFIG_NFS_V4_1)
 /*
- * EXCHANGE_ID request
+ * Decode EXCHANGE_ID response
  */
 static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p,
                                    void *res)
@@ -5492,7 +5598,7 @@ static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p,
 }
 
 /*
- * a CREATE_SESSION request
+ * Decode CREATE_SESSION response
  */
 static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p,
                                       struct nfs41_create_session_res *res)
@@ -5509,7 +5615,7 @@ static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p,
 }
 
 /*
- * a DESTROY_SESSION request
+ * Decode DESTROY_SESSION response
  */
 static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p,
                                        void *dummy)
@@ -5526,7 +5632,7 @@ static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p,
 }
 
 /*
- * a SEQUENCE request
+ * Decode SEQUENCE response
  */
 static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p,
                                 struct nfs4_sequence_res *res)
@@ -5543,7 +5649,7 @@ static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p,
 }
 
 /*
- * a GET_LEASE_TIME request
+ * Decode GET_LEASE_TIME response
  */
 static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p,
                                       struct nfs4_get_lease_time_res *res)
@@ -5562,6 +5668,25 @@ static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p,
                status = decode_fsinfo(&xdr, res->lr_fsinfo);
        return status;
 }
+
+/*
+ * Decode RECLAIM_COMPLETE response
+ */
+static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp, uint32_t *p,
+                                        struct nfs41_reclaim_complete_res *res)
+{
+       struct xdr_stream xdr;
+       struct compound_hdr hdr;
+       int status;
+
+       xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p);
+       status = decode_compound_hdr(&xdr, &hdr);
+       if (!status)
+               status = decode_sequence(&xdr, &res->seq_res, rqstp);
+       if (!status)
+               status = decode_reclaim_complete(&xdr, (void *)NULL);
+       return status;
+}
 #endif /* CONFIG_NFS_V4_1 */
 
 __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
@@ -5652,7 +5777,6 @@ static struct {
        { NFS4ERR_SERVERFAULT,  -ESERVERFAULT   },
        { NFS4ERR_BADTYPE,      -EBADTYPE       },
        { NFS4ERR_LOCKED,       -EAGAIN         },
-       { NFS4ERR_RESOURCE,     -EREMOTEIO      },
        { NFS4ERR_SYMLINK,      -ELOOP          },
        { NFS4ERR_OP_ILLEGAL,   -EOPNOTSUPP     },
        { NFS4ERR_DEADLOCK,     -EDEADLK        },
@@ -5739,6 +5863,7 @@ struct rpc_procinfo       nfs4_procedures[] = {
   PROC(DESTROY_SESSION,        enc_destroy_session,    dec_destroy_session),
   PROC(SEQUENCE,       enc_sequence,   dec_sequence),
   PROC(GET_LEASE_TIME, enc_get_lease_time,     dec_get_lease_time),
+  PROC(RECLAIM_COMPLETE, enc_reclaim_complete,  dec_reclaim_complete),
 #endif /* CONFIG_NFS_V4_1 */
 };