diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 7eeed0ed5898..7dde309ce1ac 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Kendrick Smith <kmsmith@umich.edu> | 9 | * Kendrick Smith <kmsmith@umich.edu> |
10 | * Andy Adamson <andros@umich.edu> | 10 | * Andy Adamson <andros@umich.edu> |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | 14 | * are met: |
@@ -67,7 +67,7 @@ static int nfs4_stat_to_errno(int); | |||
67 | #define NFS4_MAXTAGLEN 0 | 67 | #define NFS4_MAXTAGLEN 0 |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* lock,open owner id: | 70 | /* lock,open owner id: |
71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) | 71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) |
72 | */ | 72 | */ |
73 | #define open_owner_id_maxsz (1 + 4) | 73 | #define open_owner_id_maxsz (1 + 4) |
@@ -709,7 +709,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s | |||
709 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; | 709 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; |
710 | WRITE32(NFS4_SET_TO_SERVER_TIME); | 710 | WRITE32(NFS4_SET_TO_SERVER_TIME); |
711 | } | 711 | } |
712 | 712 | ||
713 | /* | 713 | /* |
714 | * Now we backfill the bitmap and the attribute buffer length. | 714 | * Now we backfill the bitmap and the attribute buffer length. |
715 | */ | 715 | */ |
@@ -735,7 +735,7 @@ static int encode_access(struct xdr_stream *xdr, u32 access) | |||
735 | RESERVE_SPACE(8); | 735 | RESERVE_SPACE(8); |
736 | WRITE32(OP_ACCESS); | 736 | WRITE32(OP_ACCESS); |
737 | WRITE32(access); | 737 | WRITE32(access); |
738 | 738 | ||
739 | return 0; | 739 | return 0; |
740 | } | 740 | } |
741 | 741 | ||
@@ -747,14 +747,14 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | |||
747 | WRITE32(OP_CLOSE); | 747 | WRITE32(OP_CLOSE); |
748 | WRITE32(arg->seqid->sequence->counter); | 748 | WRITE32(arg->seqid->sequence->counter); |
749 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); | 749 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
750 | 750 | ||
751 | return 0; | 751 | return 0; |
752 | } | 752 | } |
753 | 753 | ||
754 | static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 754 | static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args) |
755 | { | 755 | { |
756 | __be32 *p; | 756 | __be32 *p; |
757 | 757 | ||
758 | RESERVE_SPACE(16); | 758 | RESERVE_SPACE(16); |
759 | WRITE32(OP_COMMIT); | 759 | WRITE32(OP_COMMIT); |
760 | WRITE64(args->offset); | 760 | WRITE64(args->offset); |
@@ -766,7 +766,7 @@ static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *arg | |||
766 | static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) | 766 | static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *create) |
767 | { | 767 | { |
768 | __be32 *p; | 768 | __be32 *p; |
769 | 769 | ||
770 | RESERVE_SPACE(8); | 770 | RESERVE_SPACE(8); |
771 | WRITE32(OP_CREATE); | 771 | WRITE32(OP_CREATE); |
772 | WRITE32(create->ftype); | 772 | WRITE32(create->ftype); |
@@ -856,7 +856,7 @@ static int encode_link(struct xdr_stream *xdr, const struct qstr *name) | |||
856 | WRITE32(OP_LINK); | 856 | WRITE32(OP_LINK); |
857 | WRITE32(name->len); | 857 | WRITE32(name->len); |
858 | WRITEMEM(name->name, name->len); | 858 | WRITEMEM(name->name, name->len); |
859 | 859 | ||
860 | return 0; | 860 | return 0; |
861 | } | 861 | } |
862 | 862 | ||
@@ -1133,7 +1133,7 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
1133 | static int encode_putrootfh(struct xdr_stream *xdr) | 1133 | static int encode_putrootfh(struct xdr_stream *xdr) |
1134 | { | 1134 | { |
1135 | __be32 *p; | 1135 | __be32 *p; |
1136 | 1136 | ||
1137 | RESERVE_SPACE(4); | 1137 | RESERVE_SPACE(4); |
1138 | WRITE32(OP_PUTROOTFH); | 1138 | WRITE32(OP_PUTROOTFH); |
1139 | 1139 | ||
@@ -1232,7 +1232,7 @@ static int encode_rename(struct xdr_stream *xdr, const struct qstr *oldname, con | |||
1232 | WRITE32(OP_RENAME); | 1232 | WRITE32(OP_RENAME); |
1233 | WRITE32(oldname->len); | 1233 | WRITE32(oldname->len); |
1234 | WRITEMEM(oldname->name, oldname->len); | 1234 | WRITEMEM(oldname->name, oldname->len); |
1235 | 1235 | ||
1236 | RESERVE_SPACE(4 + newname->len); | 1236 | RESERVE_SPACE(4 + newname->len); |
1237 | WRITE32(newname->len); | 1237 | WRITE32(newname->len); |
1238 | WRITEMEM(newname->name, newname->len); | 1238 | WRITEMEM(newname->name, newname->len); |
@@ -1296,7 +1296,7 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs * | |||
1296 | { | 1296 | { |
1297 | int status; | 1297 | int status; |
1298 | __be32 *p; | 1298 | __be32 *p; |
1299 | 1299 | ||
1300 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); | 1300 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1301 | WRITE32(OP_SETATTR); | 1301 | WRITE32(OP_SETATTR); |
1302 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); | 1302 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); |
@@ -2217,7 +2217,7 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
2217 | READ_BUF(8); | 2217 | READ_BUF(8); |
2218 | READ32(hdr->status); | 2218 | READ32(hdr->status); |
2219 | READ32(hdr->taglen); | 2219 | READ32(hdr->taglen); |
2220 | 2220 | ||
2221 | READ_BUF(hdr->taglen + 4); | 2221 | READ_BUF(hdr->taglen + 4); |
2222 | hdr->tag = (char *)p; | 2222 | hdr->tag = (char *)p; |
2223 | p += XDR_QUADLEN(hdr->taglen); | 2223 | p += XDR_QUADLEN(hdr->taglen); |
@@ -3049,8 +3049,7 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | |||
3049 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) | 3049 | static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) |
3050 | { | 3050 | { |
3051 | __be32 *savep; | 3051 | __be32 *savep; |
3052 | uint32_t attrlen, | 3052 | uint32_t attrlen, bitmap[2] = {0}; |
3053 | bitmap[2] = {0}; | ||
3054 | int status; | 3053 | int status; |
3055 | 3054 | ||
3056 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 3055 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
@@ -3072,14 +3071,13 @@ xdr_error: | |||
3072 | dprintk("%s: xdr returned %d!\n", __func__, -status); | 3071 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3073 | return status; | 3072 | return status; |
3074 | } | 3073 | } |
3075 | 3074 | ||
3076 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) | 3075 | static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) |
3077 | { | 3076 | { |
3078 | __be32 *savep; | 3077 | __be32 *savep; |
3079 | uint32_t attrlen, | 3078 | uint32_t attrlen, bitmap[2] = {0}; |
3080 | bitmap[2] = {0}; | ||
3081 | int status; | 3079 | int status; |
3082 | 3080 | ||
3083 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 3081 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
3084 | goto xdr_error; | 3082 | goto xdr_error; |
3085 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 3083 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
@@ -3109,10 +3107,9 @@ xdr_error: | |||
3109 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) | 3107 | static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf) |
3110 | { | 3108 | { |
3111 | __be32 *savep; | 3109 | __be32 *savep; |
3112 | uint32_t attrlen, | 3110 | uint32_t attrlen, bitmap[2] = {0}; |
3113 | bitmap[2] = {0}; | ||
3114 | int status; | 3111 | int status; |
3115 | 3112 | ||
3116 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 3113 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
3117 | goto xdr_error; | 3114 | goto xdr_error; |
3118 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 3115 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
@@ -3258,7 +3255,7 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh) | |||
3258 | static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) | 3255 | static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) |
3259 | { | 3256 | { |
3260 | int status; | 3257 | int status; |
3261 | 3258 | ||
3262 | status = decode_op_hdr(xdr, OP_LINK); | 3259 | status = decode_op_hdr(xdr, OP_LINK); |
3263 | if (status) | 3260 | if (status) |
3264 | return status; | 3261 | return status; |
@@ -3564,7 +3561,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n | |||
3564 | dprintk("NFS: readdir reply truncated!\n"); | 3561 | dprintk("NFS: readdir reply truncated!\n"); |
3565 | entry[1] = 1; | 3562 | entry[1] = 1; |
3566 | } | 3563 | } |
3567 | out: | 3564 | out: |
3568 | kunmap_atomic(kaddr, KM_USER0); | 3565 | kunmap_atomic(kaddr, KM_USER0); |
3569 | return 0; | 3566 | return 0; |
3570 | short_pkt: | 3567 | short_pkt: |
@@ -3720,7 +3717,6 @@ static int decode_setattr(struct xdr_stream *xdr, struct nfs_setattrres *res) | |||
3720 | uint32_t bmlen; | 3717 | uint32_t bmlen; |
3721 | int status; | 3718 | int status; |
3722 | 3719 | ||
3723 | |||
3724 | status = decode_op_hdr(xdr, OP_SETATTR); | 3720 | status = decode_op_hdr(xdr, OP_SETATTR); |
3725 | if (status) | 3721 | if (status) |
3726 | return status; | 3722 | return status; |
@@ -3740,7 +3736,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
3740 | READ32(opnum); | 3736 | READ32(opnum); |
3741 | if (opnum != OP_SETCLIENTID) { | 3737 | if (opnum != OP_SETCLIENTID) { |
3742 | dprintk("nfs: decode_setclientid: Server returned operation" | 3738 | dprintk("nfs: decode_setclientid: Server returned operation" |
3743 | " %d\n", opnum); | 3739 | " %d\n", opnum); |
3744 | return -EIO; | 3740 | return -EIO; |
3745 | } | 3741 | } |
3746 | READ32(nfserr); | 3742 | READ32(nfserr); |
@@ -3829,7 +3825,7 @@ static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_ac | |||
3829 | struct xdr_stream xdr; | 3825 | struct xdr_stream xdr; |
3830 | struct compound_hdr hdr; | 3826 | struct compound_hdr hdr; |
3831 | int status; | 3827 | int status; |
3832 | 3828 | ||
3833 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3829 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3834 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3830 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3835 | goto out; | 3831 | goto out; |
@@ -3852,7 +3848,7 @@ static int nfs4_xdr_dec_lookup(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_lo | |||
3852 | struct xdr_stream xdr; | 3848 | struct xdr_stream xdr; |
3853 | struct compound_hdr hdr; | 3849 | struct compound_hdr hdr; |
3854 | int status; | 3850 | int status; |
3855 | 3851 | ||
3856 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3852 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3857 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3853 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3858 | goto out; | 3854 | goto out; |
@@ -3875,7 +3871,7 @@ static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, __be32 *p, struct nf | |||
3875 | struct xdr_stream xdr; | 3871 | struct xdr_stream xdr; |
3876 | struct compound_hdr hdr; | 3872 | struct compound_hdr hdr; |
3877 | int status; | 3873 | int status; |
3878 | 3874 | ||
3879 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3875 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3880 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3876 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3881 | goto out; | 3877 | goto out; |
@@ -3895,7 +3891,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem | |||
3895 | struct xdr_stream xdr; | 3891 | struct xdr_stream xdr; |
3896 | struct compound_hdr hdr; | 3892 | struct compound_hdr hdr; |
3897 | int status; | 3893 | int status; |
3898 | 3894 | ||
3899 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3895 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3900 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3896 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3901 | goto out; | 3897 | goto out; |
@@ -3916,7 +3912,7 @@ static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_re | |||
3916 | struct xdr_stream xdr; | 3912 | struct xdr_stream xdr; |
3917 | struct compound_hdr hdr; | 3913 | struct compound_hdr hdr; |
3918 | int status; | 3914 | int status; |
3919 | 3915 | ||
3920 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3916 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3921 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3917 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3922 | goto out; | 3918 | goto out; |
@@ -3946,7 +3942,7 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_link | |||
3946 | struct xdr_stream xdr; | 3942 | struct xdr_stream xdr; |
3947 | struct compound_hdr hdr; | 3943 | struct compound_hdr hdr; |
3948 | int status; | 3944 | int status; |
3949 | 3945 | ||
3950 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3946 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3951 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3947 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3952 | goto out; | 3948 | goto out; |
@@ -3979,7 +3975,7 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_cr | |||
3979 | struct xdr_stream xdr; | 3975 | struct xdr_stream xdr; |
3980 | struct compound_hdr hdr; | 3976 | struct compound_hdr hdr; |
3981 | int status; | 3977 | int status; |
3982 | 3978 | ||
3983 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3979 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3984 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) | 3980 | if ((status = decode_compound_hdr(&xdr, &hdr)) != 0) |
3985 | goto out; | 3981 | goto out; |
@@ -4016,7 +4012,7 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_g | |||
4016 | struct xdr_stream xdr; | 4012 | struct xdr_stream xdr; |
4017 | struct compound_hdr hdr; | 4013 | struct compound_hdr hdr; |
4018 | int status; | 4014 | int status; |
4019 | 4015 | ||
4020 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4016 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4021 | status = decode_compound_hdr(&xdr, &hdr); | 4017 | status = decode_compound_hdr(&xdr, &hdr); |
4022 | if (status) | 4018 | if (status) |