Re: acl trouble after upgrading ubuntu
[safe/jmp/linux-2.6] / fs / nfs / nfs4xdr.c
index b0d690c..3a71b40 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>
@@ -2097,7 +2096,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,
@@ -2437,7 +2436,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 +2455,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 +2487,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 +2518,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 +2527,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 +2542,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 +2573,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 +2600,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 +2624,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 +2646,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 +2667,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 +2691,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 +2715,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 +2736,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 +2758,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 +2781,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 +2804,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 +2826,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 +2848,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 +2867,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 +2924,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 +2935,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 +2993,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 +3015,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 +3037,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 +3060,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 +3086,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 +3112,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 +3136,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 +3147,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 +3161,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 +3185,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 +3199,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 +3239,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 +3265,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 +3287,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 +3309,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 +3331,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 +3353,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 +3442,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 +3462,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 +3530,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 +3621,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 +3694,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 +3794,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 +3844,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 +3911,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 +3933,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 +3944,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 +3981,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 +4051,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 +4182,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 +4309,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 +4333,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 +4347,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 +4356,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 +4418,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 +4426,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 +4471,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 +4512,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);
@@ -4576,7 +4584,7 @@ static int decode_sequence(struct xdr_stream *xdr,
        /* target highest slot id - currently not processed */
        dummy = be32_to_cpup(p++);
        /* result flags - currently not processed */
-       dummy = be32_to_cpup(p++);
+       dummy = be32_to_cpup(p);
        status = 0;
 out_err:
        res->sr_status = status;
@@ -4616,7 +4624,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 +4652,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 +4680,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 +4705,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 +4731,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 +4762,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 +4801,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 +4836,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 +4874,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 +4982,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 +5015,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 +5069,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 +5097,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 +5272,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,7 +5302,8 @@ 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;
 }
@@ -5440,7 +5467,8 @@ 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;
 }
@@ -5468,7 +5496,8 @@ 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;
 }
@@ -5652,7 +5681,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        },