diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 490 |
1 files changed, 245 insertions, 245 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 7dde309ce1ac..29656c5090c2 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -755,12 +755,12 @@ static int encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *arg | |||
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); |
761 | WRITE32(args->count); | 761 | WRITE32(args->count); |
762 | 762 | ||
763 | return 0; | 763 | return 0; |
764 | } | 764 | } |
765 | 765 | ||
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) |
@@ -797,25 +797,25 @@ static int encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *c | |||
797 | 797 | ||
798 | static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) | 798 | static int encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap) |
799 | { | 799 | { |
800 | __be32 *p; | 800 | __be32 *p; |
801 | 801 | ||
802 | RESERVE_SPACE(12); | 802 | RESERVE_SPACE(12); |
803 | WRITE32(OP_GETATTR); | 803 | WRITE32(OP_GETATTR); |
804 | WRITE32(1); | 804 | WRITE32(1); |
805 | WRITE32(bitmap); | 805 | WRITE32(bitmap); |
806 | return 0; | 806 | return 0; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) | 809 | static int encode_getattr_two(struct xdr_stream *xdr, uint32_t bm0, uint32_t bm1) |
810 | { | 810 | { |
811 | __be32 *p; | 811 | __be32 *p; |
812 | 812 | ||
813 | RESERVE_SPACE(16); | 813 | RESERVE_SPACE(16); |
814 | WRITE32(OP_GETATTR); | 814 | WRITE32(OP_GETATTR); |
815 | WRITE32(2); | 815 | WRITE32(2); |
816 | WRITE32(bm0); | 816 | WRITE32(bm0); |
817 | WRITE32(bm1); | 817 | WRITE32(bm1); |
818 | return 0; | 818 | return 0; |
819 | } | 819 | } |
820 | 820 | ||
821 | static int encode_getfattr(struct xdr_stream *xdr, const u32* bitmask) | 821 | static int encode_getfattr(struct xdr_stream *xdr, const u32* bitmask) |
@@ -959,17 +959,17 @@ static void encode_share_access(struct xdr_stream *xdr, fmode_t fmode) | |||
959 | 959 | ||
960 | RESERVE_SPACE(8); | 960 | RESERVE_SPACE(8); |
961 | switch (fmode & (FMODE_READ|FMODE_WRITE)) { | 961 | switch (fmode & (FMODE_READ|FMODE_WRITE)) { |
962 | case FMODE_READ: | 962 | case FMODE_READ: |
963 | WRITE32(NFS4_SHARE_ACCESS_READ); | 963 | WRITE32(NFS4_SHARE_ACCESS_READ); |
964 | break; | 964 | break; |
965 | case FMODE_WRITE: | 965 | case FMODE_WRITE: |
966 | WRITE32(NFS4_SHARE_ACCESS_WRITE); | 966 | WRITE32(NFS4_SHARE_ACCESS_WRITE); |
967 | break; | 967 | break; |
968 | case FMODE_READ|FMODE_WRITE: | 968 | case FMODE_READ|FMODE_WRITE: |
969 | WRITE32(NFS4_SHARE_ACCESS_BOTH); | 969 | WRITE32(NFS4_SHARE_ACCESS_BOTH); |
970 | break; | 970 | break; |
971 | default: | 971 | default: |
972 | WRITE32(0); | 972 | WRITE32(0); |
973 | } | 973 | } |
974 | WRITE32(0); /* for linux, share_deny = 0 always */ | 974 | WRITE32(0); /* for linux, share_deny = 0 always */ |
975 | } | 975 | } |
@@ -998,13 +998,13 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op | |||
998 | 998 | ||
999 | RESERVE_SPACE(4); | 999 | RESERVE_SPACE(4); |
1000 | switch(arg->open_flags & O_EXCL) { | 1000 | switch(arg->open_flags & O_EXCL) { |
1001 | case 0: | 1001 | case 0: |
1002 | WRITE32(NFS4_CREATE_UNCHECKED); | 1002 | WRITE32(NFS4_CREATE_UNCHECKED); |
1003 | encode_attrs(xdr, arg->u.attrs, arg->server); | 1003 | encode_attrs(xdr, arg->u.attrs, arg->server); |
1004 | break; | 1004 | break; |
1005 | default: | 1005 | default: |
1006 | WRITE32(NFS4_CREATE_EXCLUSIVE); | 1006 | WRITE32(NFS4_CREATE_EXCLUSIVE); |
1007 | encode_nfs4_verifier(xdr, &arg->u.verifier); | 1007 | encode_nfs4_verifier(xdr, &arg->u.verifier); |
1008 | } | 1008 | } |
1009 | } | 1009 | } |
1010 | 1010 | ||
@@ -1014,13 +1014,13 @@ static void encode_opentype(struct xdr_stream *xdr, const struct nfs_openargs *a | |||
1014 | 1014 | ||
1015 | RESERVE_SPACE(4); | 1015 | RESERVE_SPACE(4); |
1016 | switch (arg->open_flags & O_CREAT) { | 1016 | switch (arg->open_flags & O_CREAT) { |
1017 | case 0: | 1017 | case 0: |
1018 | WRITE32(NFS4_OPEN_NOCREATE); | 1018 | WRITE32(NFS4_OPEN_NOCREATE); |
1019 | break; | 1019 | break; |
1020 | default: | 1020 | default: |
1021 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); | 1021 | BUG_ON(arg->claim != NFS4_OPEN_CLAIM_NULL); |
1022 | WRITE32(NFS4_OPEN_CREATE); | 1022 | WRITE32(NFS4_OPEN_CREATE); |
1023 | encode_createmode(xdr, arg); | 1023 | encode_createmode(xdr, arg); |
1024 | } | 1024 | } |
1025 | } | 1025 | } |
1026 | 1026 | ||
@@ -1030,17 +1030,17 @@ static inline void encode_delegation_type(struct xdr_stream *xdr, fmode_t delega | |||
1030 | 1030 | ||
1031 | RESERVE_SPACE(4); | 1031 | RESERVE_SPACE(4); |
1032 | switch (delegation_type) { | 1032 | switch (delegation_type) { |
1033 | case 0: | 1033 | case 0: |
1034 | WRITE32(NFS4_OPEN_DELEGATE_NONE); | 1034 | WRITE32(NFS4_OPEN_DELEGATE_NONE); |
1035 | break; | 1035 | break; |
1036 | case FMODE_READ: | 1036 | case FMODE_READ: |
1037 | WRITE32(NFS4_OPEN_DELEGATE_READ); | 1037 | WRITE32(NFS4_OPEN_DELEGATE_READ); |
1038 | break; | 1038 | break; |
1039 | case FMODE_WRITE|FMODE_READ: | 1039 | case FMODE_WRITE|FMODE_READ: |
1040 | WRITE32(NFS4_OPEN_DELEGATE_WRITE); | 1040 | WRITE32(NFS4_OPEN_DELEGATE_WRITE); |
1041 | break; | 1041 | break; |
1042 | default: | 1042 | default: |
1043 | BUG(); | 1043 | BUG(); |
1044 | } | 1044 | } |
1045 | } | 1045 | } |
1046 | 1046 | ||
@@ -1077,17 +1077,17 @@ static int encode_open(struct xdr_stream *xdr, const struct nfs_openargs *arg) | |||
1077 | encode_openhdr(xdr, arg); | 1077 | encode_openhdr(xdr, arg); |
1078 | encode_opentype(xdr, arg); | 1078 | encode_opentype(xdr, arg); |
1079 | switch (arg->claim) { | 1079 | switch (arg->claim) { |
1080 | case NFS4_OPEN_CLAIM_NULL: | 1080 | case NFS4_OPEN_CLAIM_NULL: |
1081 | encode_claim_null(xdr, arg->name); | 1081 | encode_claim_null(xdr, arg->name); |
1082 | break; | 1082 | break; |
1083 | case NFS4_OPEN_CLAIM_PREVIOUS: | 1083 | case NFS4_OPEN_CLAIM_PREVIOUS: |
1084 | encode_claim_previous(xdr, arg->u.delegation_type); | 1084 | encode_claim_previous(xdr, arg->u.delegation_type); |
1085 | break; | 1085 | break; |
1086 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: | 1086 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: |
1087 | encode_claim_delegate_cur(xdr, arg->name, &arg->u.delegation); | 1087 | encode_claim_delegate_cur(xdr, arg->name, &arg->u.delegation); |
1088 | break; | 1088 | break; |
1089 | default: | 1089 | default: |
1090 | BUG(); | 1090 | BUG(); |
1091 | } | 1091 | } |
1092 | return 0; | 1092 | return 0; |
1093 | } | 1093 | } |
@@ -1132,12 +1132,12 @@ encode_putfh(struct xdr_stream *xdr, const struct nfs_fh *fh) | |||
1132 | 1132 | ||
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 | ||
1140 | return 0; | 1140 | return 0; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) | 1143 | static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context *ctx) |
@@ -1297,14 +1297,14 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs * | |||
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); |
1303 | 1303 | ||
1304 | if ((status = encode_attrs(xdr, arg->iap, server))) | 1304 | if ((status = encode_attrs(xdr, arg->iap, server))) |
1305 | return status; | 1305 | return status; |
1306 | 1306 | ||
1307 | return 0; | 1307 | return 0; |
1308 | } | 1308 | } |
1309 | 1309 | ||
1310 | static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) | 1310 | static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid) |
@@ -1328,14 +1328,14 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien | |||
1328 | 1328 | ||
1329 | static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) | 1329 | static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state) |
1330 | { | 1330 | { |
1331 | __be32 *p; | 1331 | __be32 *p; |
1332 | 1332 | ||
1333 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); | 1333 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); |
1334 | WRITE32(OP_SETCLIENTID_CONFIRM); | 1334 | WRITE32(OP_SETCLIENTID_CONFIRM); |
1335 | WRITE64(client_state->cl_clientid); | 1335 | WRITE64(client_state->cl_clientid); |
1336 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); | 1336 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); |
1337 | 1337 | ||
1338 | return 0; | 1338 | return 0; |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) | 1341 | static int encode_write(struct xdr_stream *xdr, const struct nfs_writeargs *args) |
@@ -1584,23 +1584,23 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1584 | */ | 1584 | */ |
1585 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) | 1585 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) |
1586 | { | 1586 | { |
1587 | struct xdr_stream xdr; | 1587 | struct xdr_stream xdr; |
1588 | struct compound_hdr hdr = { | 1588 | struct compound_hdr hdr = { |
1589 | .nops = 3, | 1589 | .nops = 3, |
1590 | }; | 1590 | }; |
1591 | int status; | 1591 | int status; |
1592 | 1592 | ||
1593 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1593 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1594 | encode_compound_hdr(&xdr, &hdr); | 1594 | encode_compound_hdr(&xdr, &hdr); |
1595 | status = encode_putfh(&xdr, args->fh); | 1595 | status = encode_putfh(&xdr, args->fh); |
1596 | if(status) | 1596 | if(status) |
1597 | goto out; | 1597 | goto out; |
1598 | status = encode_close(&xdr, args); | 1598 | status = encode_close(&xdr, args); |
1599 | if (status != 0) | 1599 | if (status != 0) |
1600 | goto out; | 1600 | goto out; |
1601 | status = encode_getfattr(&xdr, args->bitmask); | 1601 | status = encode_getfattr(&xdr, args->bitmask); |
1602 | out: | 1602 | out: |
1603 | return status; | 1603 | return status; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | /* | 1606 | /* |
@@ -1875,25 +1875,24 @@ out: | |||
1875 | * Encode an SETATTR request | 1875 | * Encode an SETATTR request |
1876 | */ | 1876 | */ |
1877 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) | 1877 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) |
1878 | |||
1879 | { | 1878 | { |
1880 | struct xdr_stream xdr; | 1879 | struct xdr_stream xdr; |
1881 | struct compound_hdr hdr = { | 1880 | struct compound_hdr hdr = { |
1882 | .nops = 3, | 1881 | .nops = 3, |
1883 | }; | 1882 | }; |
1884 | int status; | 1883 | int status; |
1885 | 1884 | ||
1886 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1885 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
1887 | encode_compound_hdr(&xdr, &hdr); | 1886 | encode_compound_hdr(&xdr, &hdr); |
1888 | status = encode_putfh(&xdr, args->fh); | 1887 | status = encode_putfh(&xdr, args->fh); |
1889 | if(status) | 1888 | if(status) |
1890 | goto out; | 1889 | goto out; |
1891 | status = encode_setattr(&xdr, args, args->server); | 1890 | status = encode_setattr(&xdr, args, args->server); |
1892 | if(status) | 1891 | if(status) |
1893 | goto out; | 1892 | goto out; |
1894 | status = encode_getfattr(&xdr, args->bitmask); | 1893 | status = encode_getfattr(&xdr, args->bitmask); |
1895 | out: | 1894 | out: |
1896 | return status; | 1895 | return status; |
1897 | } | 1896 | } |
1898 | 1897 | ||
1899 | /* | 1898 | /* |
@@ -3343,27 +3342,27 @@ static int decode_lookup(struct xdr_stream *xdr) | |||
3343 | /* This is too sick! */ | 3342 | /* This is too sick! */ |
3344 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) | 3343 | static int decode_space_limit(struct xdr_stream *xdr, u64 *maxsize) |
3345 | { | 3344 | { |
3346 | __be32 *p; | 3345 | __be32 *p; |
3347 | uint32_t limit_type, nblocks, blocksize; | 3346 | uint32_t limit_type, nblocks, blocksize; |
3348 | 3347 | ||
3349 | READ_BUF(12); | 3348 | READ_BUF(12); |
3350 | READ32(limit_type); | 3349 | READ32(limit_type); |
3351 | switch (limit_type) { | 3350 | switch (limit_type) { |
3352 | case 1: | 3351 | case 1: |
3353 | READ64(*maxsize); | 3352 | READ64(*maxsize); |
3354 | break; | 3353 | break; |
3355 | case 2: | 3354 | case 2: |
3356 | READ32(nblocks); | 3355 | READ32(nblocks); |
3357 | READ32(blocksize); | 3356 | READ32(blocksize); |
3358 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; | 3357 | *maxsize = (uint64_t)nblocks * (uint64_t)blocksize; |
3359 | } | 3358 | } |
3360 | return 0; | 3359 | return 0; |
3361 | } | 3360 | } |
3362 | 3361 | ||
3363 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | 3362 | static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) |
3364 | { | 3363 | { |
3365 | __be32 *p; | 3364 | __be32 *p; |
3366 | uint32_t delegation_type; | 3365 | uint32_t delegation_type; |
3367 | 3366 | ||
3368 | READ_BUF(4); | 3367 | READ_BUF(4); |
3369 | READ32(delegation_type); | 3368 | READ32(delegation_type); |
@@ -3374,13 +3373,14 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3374 | READ_BUF(NFS4_STATEID_SIZE+4); | 3373 | READ_BUF(NFS4_STATEID_SIZE+4); |
3375 | COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); | 3374 | COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); |
3376 | READ32(res->do_recall); | 3375 | READ32(res->do_recall); |
3376 | |||
3377 | switch (delegation_type) { | 3377 | switch (delegation_type) { |
3378 | case NFS4_OPEN_DELEGATE_READ: | 3378 | case NFS4_OPEN_DELEGATE_READ: |
3379 | res->delegation_type = FMODE_READ; | 3379 | res->delegation_type = FMODE_READ; |
3380 | break; | 3380 | break; |
3381 | case NFS4_OPEN_DELEGATE_WRITE: | 3381 | case NFS4_OPEN_DELEGATE_WRITE: |
3382 | res->delegation_type = FMODE_WRITE|FMODE_READ; | 3382 | res->delegation_type = FMODE_WRITE|FMODE_READ; |
3383 | if (decode_space_limit(xdr, &res->maxsize) < 0) | 3383 | if (decode_space_limit(xdr, &res->maxsize) < 0) |
3384 | return -EIO; | 3384 | return -EIO; |
3385 | } | 3385 | } |
3386 | return decode_ace(xdr, NULL, res->server->nfs_client); | 3386 | return decode_ace(xdr, NULL, res->server->nfs_client); |
@@ -3388,27 +3388,27 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3388 | 3388 | ||
3389 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | 3389 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) |
3390 | { | 3390 | { |
3391 | __be32 *p; | 3391 | __be32 *p; |
3392 | uint32_t savewords, bmlen, i; | 3392 | uint32_t savewords, bmlen, i; |
3393 | int status; | 3393 | int status; |
3394 | 3394 | ||
3395 | status = decode_op_hdr(xdr, OP_OPEN); | 3395 | status = decode_op_hdr(xdr, OP_OPEN); |
3396 | if (status != -EIO) | 3396 | if (status != -EIO) |
3397 | nfs_increment_open_seqid(status, res->seqid); | 3397 | nfs_increment_open_seqid(status, res->seqid); |
3398 | if (status) | 3398 | if (status) |
3399 | return status; | 3399 | return status; |
3400 | READ_BUF(NFS4_STATEID_SIZE); | 3400 | READ_BUF(NFS4_STATEID_SIZE); |
3401 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); | 3401 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3402 | 3402 | ||
3403 | decode_change_info(xdr, &res->cinfo); | 3403 | decode_change_info(xdr, &res->cinfo); |
3404 | 3404 | ||
3405 | READ_BUF(8); | 3405 | READ_BUF(8); |
3406 | READ32(res->rflags); | 3406 | READ32(res->rflags); |
3407 | READ32(bmlen); | 3407 | READ32(bmlen); |
3408 | if (bmlen > 10) | 3408 | if (bmlen > 10) |
3409 | goto xdr_error; | 3409 | goto xdr_error; |
3410 | 3410 | ||
3411 | READ_BUF(bmlen << 2); | 3411 | READ_BUF(bmlen << 2); |
3412 | savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); | 3412 | savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); |
3413 | for (i = 0; i < savewords; ++i) | 3413 | for (i = 0; i < savewords; ++i) |
3414 | READ32(res->attrset[i]); | 3414 | READ32(res->attrset[i]); |
@@ -3423,17 +3423,17 @@ xdr_error: | |||
3423 | 3423 | ||
3424 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) | 3424 | static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) |
3425 | { | 3425 | { |
3426 | __be32 *p; | 3426 | __be32 *p; |
3427 | int status; | 3427 | int status; |
3428 | 3428 | ||
3429 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); | 3429 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); |
3430 | if (status != -EIO) | 3430 | if (status != -EIO) |
3431 | nfs_increment_open_seqid(status, res->seqid); | 3431 | nfs_increment_open_seqid(status, res->seqid); |
3432 | if (status) | 3432 | if (status) |
3433 | return status; | 3433 | return status; |
3434 | READ_BUF(NFS4_STATEID_SIZE); | 3434 | READ_BUF(NFS4_STATEID_SIZE); |
3435 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); | 3435 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3436 | return 0; | 3436 | return 0; |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) | 3439 | static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *res) |
@@ -3794,23 +3794,23 @@ static int decode_delegreturn(struct xdr_stream *xdr) | |||
3794 | */ | 3794 | */ |
3795 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) | 3795 | static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
3796 | { | 3796 | { |
3797 | struct xdr_stream xdr; | 3797 | struct xdr_stream xdr; |
3798 | struct compound_hdr hdr; | 3798 | struct compound_hdr hdr; |
3799 | int status; | 3799 | int status; |
3800 | 3800 | ||
3801 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 3801 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
3802 | status = decode_compound_hdr(&xdr, &hdr); | 3802 | status = decode_compound_hdr(&xdr, &hdr); |
3803 | if (status) | 3803 | if (status) |
3804 | goto out; | 3804 | goto out; |
3805 | status = decode_putfh(&xdr); | 3805 | status = decode_putfh(&xdr); |
3806 | if (status) | 3806 | if (status) |
3807 | goto out; | 3807 | goto out; |
3808 | status = decode_open_downgrade(&xdr, res); | 3808 | status = decode_open_downgrade(&xdr, res); |
3809 | if (status != 0) | 3809 | if (status != 0) |
3810 | goto out; | 3810 | goto out; |
3811 | decode_getfattr(&xdr, res->fattr, res->server); | 3811 | decode_getfattr(&xdr, res->fattr, res->server); |
3812 | out: | 3812 | out: |
3813 | return status; | 3813 | return status; |
3814 | } | 3814 | } |
3815 | 3815 | ||
3816 | /* | 3816 | /* |
@@ -4023,7 +4023,6 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_g | |||
4023 | status = decode_getfattr(&xdr, res->fattr, res->server); | 4023 | status = decode_getfattr(&xdr, res->fattr, res->server); |
4024 | out: | 4024 | out: |
4025 | return status; | 4025 | return status; |
4026 | |||
4027 | } | 4026 | } |
4028 | 4027 | ||
4029 | /* | 4028 | /* |
@@ -4032,21 +4031,22 @@ out: | |||
4032 | static int | 4031 | static int |
4033 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) | 4032 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) |
4034 | { | 4033 | { |
4035 | struct xdr_stream xdr; | 4034 | struct xdr_stream xdr; |
4036 | struct compound_hdr hdr = { | 4035 | struct compound_hdr hdr = { |
4037 | .nops = 2, | 4036 | .nops = 2, |
4038 | }; | 4037 | }; |
4039 | int status; | 4038 | int status; |
4040 | 4039 | ||
4041 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 4040 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); |
4042 | encode_compound_hdr(&xdr, &hdr); | 4041 | encode_compound_hdr(&xdr, &hdr); |
4043 | status = encode_putfh(&xdr, args->fh); | 4042 | status = encode_putfh(&xdr, args->fh); |
4044 | if (status) | 4043 | if (status) |
4045 | goto out; | 4044 | goto out; |
4046 | status = encode_setacl(&xdr, args); | 4045 | status = encode_setacl(&xdr, args); |
4047 | out: | 4046 | out: |
4048 | return status; | 4047 | return status; |
4049 | } | 4048 | } |
4049 | |||
4050 | /* | 4050 | /* |
4051 | * Decode SETACL response | 4051 | * Decode SETACL response |
4052 | */ | 4052 | */ |
@@ -4097,18 +4097,18 @@ out: | |||
4097 | */ | 4097 | */ |
4098 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) | 4098 | static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_closeres *res) |
4099 | { | 4099 | { |
4100 | struct xdr_stream xdr; | 4100 | struct xdr_stream xdr; |
4101 | struct compound_hdr hdr; | 4101 | struct compound_hdr hdr; |
4102 | int status; | 4102 | int status; |
4103 | 4103 | ||
4104 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4104 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4105 | status = decode_compound_hdr(&xdr, &hdr); | 4105 | status = decode_compound_hdr(&xdr, &hdr); |
4106 | if (status) | 4106 | if (status) |
4107 | goto out; | 4107 | goto out; |
4108 | status = decode_putfh(&xdr); | 4108 | status = decode_putfh(&xdr); |
4109 | if (status) | 4109 | if (status) |
4110 | goto out; | 4110 | goto out; |
4111 | status = decode_close(&xdr, res); | 4111 | status = decode_close(&xdr, res); |
4112 | if (status != 0) | 4112 | if (status != 0) |
4113 | goto out; | 4113 | goto out; |
4114 | /* | 4114 | /* |
@@ -4119,7 +4119,7 @@ static int nfs4_xdr_dec_close(struct rpc_rqst *rqstp, __be32 *p, struct nfs_clos | |||
4119 | */ | 4119 | */ |
4120 | decode_getfattr(&xdr, res->fattr, res->server); | 4120 | decode_getfattr(&xdr, res->fattr, res->server); |
4121 | out: | 4121 | out: |
4122 | return status; | 4122 | return status; |
4123 | } | 4123 | } |
4124 | 4124 | ||
4125 | /* | 4125 | /* |
@@ -4127,23 +4127,23 @@ out: | |||
4127 | */ | 4127 | */ |
4128 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) | 4128 | static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
4129 | { | 4129 | { |
4130 | struct xdr_stream xdr; | 4130 | struct xdr_stream xdr; |
4131 | struct compound_hdr hdr; | 4131 | struct compound_hdr hdr; |
4132 | int status; | 4132 | int status; |
4133 | 4133 | ||
4134 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4134 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4135 | status = decode_compound_hdr(&xdr, &hdr); | 4135 | status = decode_compound_hdr(&xdr, &hdr); |
4136 | if (status) | 4136 | if (status) |
4137 | goto out; | 4137 | goto out; |
4138 | status = decode_putfh(&xdr); | 4138 | status = decode_putfh(&xdr); |
4139 | if (status) | 4139 | if (status) |
4140 | goto out; | 4140 | goto out; |
4141 | status = decode_savefh(&xdr); | 4141 | status = decode_savefh(&xdr); |
4142 | if (status) | ||
4143 | goto out; | ||
4144 | status = decode_open(&xdr, res); | ||
4142 | if (status) | 4145 | if (status) |
4143 | goto out; | 4146 | goto out; |
4144 | status = decode_open(&xdr, res); | ||
4145 | if (status) | ||
4146 | goto out; | ||
4147 | if (decode_getfh(&xdr, &res->fh) != 0) | 4147 | if (decode_getfh(&xdr, &res->fh) != 0) |
4148 | goto out; | 4148 | goto out; |
4149 | if (decode_getfattr(&xdr, res->f_attr, res->server) != 0) | 4149 | if (decode_getfattr(&xdr, res->f_attr, res->server) != 0) |
@@ -4152,7 +4152,7 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openr | |||
4152 | goto out; | 4152 | goto out; |
4153 | decode_getfattr(&xdr, res->dir_attr, res->server); | 4153 | decode_getfattr(&xdr, res->dir_attr, res->server); |
4154 | out: | 4154 | out: |
4155 | return status; | 4155 | return status; |
4156 | } | 4156 | } |
4157 | 4157 | ||
4158 | /* | 4158 | /* |
@@ -4160,20 +4160,20 @@ out: | |||
4160 | */ | 4160 | */ |
4161 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) | 4161 | static int nfs4_xdr_dec_open_confirm(struct rpc_rqst *rqstp, __be32 *p, struct nfs_open_confirmres *res) |
4162 | { | 4162 | { |
4163 | struct xdr_stream xdr; | 4163 | struct xdr_stream xdr; |
4164 | struct compound_hdr hdr; | 4164 | struct compound_hdr hdr; |
4165 | int status; | 4165 | int status; |
4166 | 4166 | ||
4167 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4167 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4168 | status = decode_compound_hdr(&xdr, &hdr); | 4168 | status = decode_compound_hdr(&xdr, &hdr); |
4169 | if (status) | 4169 | if (status) |
4170 | goto out; | 4170 | goto out; |
4171 | status = decode_putfh(&xdr); | 4171 | status = decode_putfh(&xdr); |
4172 | if (status) | 4172 | if (status) |
4173 | goto out; | 4173 | goto out; |
4174 | status = decode_open_confirm(&xdr, res); | 4174 | status = decode_open_confirm(&xdr, res); |
4175 | out: | 4175 | out: |
4176 | return status; | 4176 | return status; |
4177 | } | 4177 | } |
4178 | 4178 | ||
4179 | /* | 4179 | /* |
@@ -4181,23 +4181,23 @@ out: | |||
4181 | */ | 4181 | */ |
4182 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) | 4182 | static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openres *res) |
4183 | { | 4183 | { |
4184 | struct xdr_stream xdr; | 4184 | struct xdr_stream xdr; |
4185 | struct compound_hdr hdr; | 4185 | struct compound_hdr hdr; |
4186 | int status; | 4186 | int status; |
4187 | 4187 | ||
4188 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4188 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4189 | status = decode_compound_hdr(&xdr, &hdr); | 4189 | status = decode_compound_hdr(&xdr, &hdr); |
4190 | if (status) | 4190 | if (status) |
4191 | goto out; | 4191 | goto out; |
4192 | status = decode_putfh(&xdr); | 4192 | status = decode_putfh(&xdr); |
4193 | if (status) | 4193 | if (status) |
4194 | goto out; | 4194 | goto out; |
4195 | status = decode_open(&xdr, res); | 4195 | status = decode_open(&xdr, res); |
4196 | if (status) | 4196 | if (status) |
4197 | goto out; | 4197 | goto out; |
4198 | decode_getfattr(&xdr, res->f_attr, res->server); | 4198 | decode_getfattr(&xdr, res->f_attr, res->server); |
4199 | out: | 4199 | out: |
4200 | return status; | 4200 | return status; |
4201 | } | 4201 | } |
4202 | 4202 | ||
4203 | /* | 4203 | /* |
@@ -4205,25 +4205,25 @@ out: | |||
4205 | */ | 4205 | */ |
4206 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) | 4206 | static int nfs4_xdr_dec_setattr(struct rpc_rqst *rqstp, __be32 *p, struct nfs_setattrres *res) |
4207 | { | 4207 | { |
4208 | struct xdr_stream xdr; | 4208 | struct xdr_stream xdr; |
4209 | struct compound_hdr hdr; | 4209 | struct compound_hdr hdr; |
4210 | int status; | 4210 | int status; |
4211 | 4211 | ||
4212 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | 4212 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); |
4213 | status = decode_compound_hdr(&xdr, &hdr); | 4213 | status = decode_compound_hdr(&xdr, &hdr); |
4214 | if (status) | 4214 | if (status) |
4215 | goto out; | 4215 | goto out; |
4216 | status = decode_putfh(&xdr); | 4216 | status = decode_putfh(&xdr); |
4217 | if (status) | 4217 | if (status) |
4218 | goto out; | 4218 | goto out; |
4219 | status = decode_setattr(&xdr, res); | 4219 | status = decode_setattr(&xdr, res); |
4220 | if (status) | 4220 | if (status) |
4221 | goto out; | 4221 | goto out; |
4222 | status = decode_getfattr(&xdr, res->fattr, res->server); | 4222 | status = decode_getfattr(&xdr, res->fattr, res->server); |
4223 | if (status == NFS4ERR_DELAY) | 4223 | if (status == NFS4ERR_DELAY) |
4224 | status = 0; | 4224 | status = 0; |
4225 | out: | 4225 | out: |
4226 | return status; | 4226 | return status; |
4227 | } | 4227 | } |
4228 | 4228 | ||
4229 | /* | 4229 | /* |
@@ -4707,7 +4707,7 @@ nfs4_stat_to_errno(int stat) | |||
4707 | .p_replen = NFS4_##restype##_sz, \ | 4707 | .p_replen = NFS4_##restype##_sz, \ |
4708 | .p_statidx = NFSPROC4_CLNT_##proc, \ | 4708 | .p_statidx = NFSPROC4_CLNT_##proc, \ |
4709 | .p_name = #proc, \ | 4709 | .p_name = #proc, \ |
4710 | } | 4710 | } |
4711 | 4711 | ||
4712 | struct rpc_procinfo nfs4_procedures[] = { | 4712 | struct rpc_procinfo nfs4_procedures[] = { |
4713 | PROC(READ, enc_read, dec_read), | 4713 | PROC(READ, enc_read, dec_read), |