~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal

« back to all changes in this revision

Viewing changes to fs/nfs/nfs4xdr.c

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-04kado7d1u2er2rl
Tags: 3.2.0-16.25
Add new lowlatency kernel flavour

Show diffs side-by-side

added added

removed removed

Lines of Context:
2517
2517
        encode_compound_hdr(xdr, req, &hdr);
2518
2518
        encode_sequence(xdr, &args->seq_args, &hdr);
2519
2519
        encode_putfh(xdr, args->fh, &hdr);
2520
 
        replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1;
 
2520
        replen = hdr.replen + op_decode_hdr_maxsz + 1;
2521
2521
        encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);
2522
2522
 
2523
2523
        xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
2524
2524
                args->acl_pages, args->acl_pgbase, args->acl_len);
 
2525
        xdr_set_scratch_buffer(xdr, page_address(args->acl_scratch), PAGE_SIZE);
 
2526
 
2525
2527
        encode_nops(&hdr);
2526
2528
}
2527
2529
 
4957
4959
}
4958
4960
 
4959
4961
static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
4960
 
                size_t *acl_len)
 
4962
                         struct nfs_getaclres *res)
4961
4963
{
4962
 
        __be32 *savep;
 
4964
        __be32 *savep, *bm_p;
4963
4965
        uint32_t attrlen,
4964
4966
                 bitmap[3] = {0};
4965
4967
        struct kvec *iov = req->rq_rcv_buf.head;
4966
4968
        int status;
4967
4969
 
4968
 
        *acl_len = 0;
 
4970
        res->acl_len = 0;
4969
4971
        if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
4970
4972
                goto out;
 
4973
        bm_p = xdr->p;
4971
4974
        if ((status = decode_attr_bitmap(xdr, bitmap)) != 0)
4972
4975
                goto out;
4973
4976
        if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0)
4979
4982
                size_t hdrlen;
4980
4983
                u32 recvd;
4981
4984
 
 
4985
                /* The bitmap (xdr len + bitmaps) and the attr xdr len words
 
4986
                 * are stored with the acl data to handle the problem of
 
4987
                 * variable length bitmaps.*/
 
4988
                xdr->p = bm_p;
 
4989
                res->acl_data_offset = be32_to_cpup(bm_p) + 2;
 
4990
                res->acl_data_offset <<= 2;
 
4991
 
4982
4992
                /* We ignore &savep and don't do consistency checks on
4983
4993
                 * the attr length.  Let userspace figure it out.... */
4984
4994
                hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base;
 
4995
                attrlen += res->acl_data_offset;
4985
4996
                recvd = req->rq_rcv_buf.len - hdrlen;
4986
4997
                if (attrlen > recvd) {
4987
 
                        dprintk("NFS: server cheating in getattr"
4988
 
                                        " acl reply: attrlen %u > recvd %u\n",
 
4998
                        if (res->acl_flags & NFS4_ACL_LEN_REQUEST) {
 
4999
                                /* getxattr interface called with a NULL buf */
 
5000
                                res->acl_len = attrlen;
 
5001
                                goto out;
 
5002
                        }
 
5003
                        dprintk("NFS: acl reply: attrlen %u > recvd %u\n",
4989
5004
                                        attrlen, recvd);
4990
5005
                        return -EINVAL;
4991
5006
                }
4992
5007
                xdr_read_pages(xdr, attrlen);
4993
 
                *acl_len = attrlen;
 
5008
                res->acl_len = attrlen;
4994
5009
        } else
4995
5010
                status = -EOPNOTSUPP;
4996
5011
 
6028
6043
        status = decode_putfh(xdr);
6029
6044
        if (status)
6030
6045
                goto out;
6031
 
        status = decode_getacl(xdr, rqstp, &res->acl_len);
 
6046
        status = decode_getacl(xdr, rqstp, res);
6032
6047
 
6033
6048
out:
6034
6049
        return status;