diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 154 |
1 files changed, 130 insertions, 24 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 20b4e30e6c82..38f3b582e7c2 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/param.h> | 38 | #include <linux/param.h> |
39 | #include <linux/time.h> | 39 | #include <linux/time.h> |
40 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
41 | #include <linux/slab.h> | ||
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/string.h> | 42 | #include <linux/string.h> |
44 | #include <linux/in.h> | 43 | #include <linux/in.h> |
@@ -46,11 +45,13 @@ | |||
46 | #include <linux/proc_fs.h> | 45 | #include <linux/proc_fs.h> |
47 | #include <linux/kdev_t.h> | 46 | #include <linux/kdev_t.h> |
48 | #include <linux/sunrpc/clnt.h> | 47 | #include <linux/sunrpc/clnt.h> |
48 | #include <linux/sunrpc/msg_prot.h> | ||
49 | #include <linux/nfs.h> | 49 | #include <linux/nfs.h> |
50 | #include <linux/nfs4.h> | 50 | #include <linux/nfs4.h> |
51 | #include <linux/nfs_fs.h> | 51 | #include <linux/nfs_fs.h> |
52 | #include <linux/nfs_idmap.h> | 52 | #include <linux/nfs_idmap.h> |
53 | #include "nfs4_fs.h" | 53 | #include "nfs4_fs.h" |
54 | #include "internal.h" | ||
54 | 55 | ||
55 | #define NFSDBG_FACILITY NFSDBG_XDR | 56 | #define NFSDBG_FACILITY NFSDBG_XDR |
56 | 57 | ||
@@ -134,7 +135,7 @@ static int nfs4_stat_to_errno(int); | |||
134 | #define decode_lookup_maxsz (op_decode_hdr_maxsz) | 135 | #define decode_lookup_maxsz (op_decode_hdr_maxsz) |
135 | #define encode_share_access_maxsz \ | 136 | #define encode_share_access_maxsz \ |
136 | (2) | 137 | (2) |
137 | #define encode_createmode_maxsz (1 + encode_attrs_maxsz) | 138 | #define encode_createmode_maxsz (1 + encode_attrs_maxsz + encode_verifier_maxsz) |
138 | #define encode_opentype_maxsz (1 + encode_createmode_maxsz) | 139 | #define encode_opentype_maxsz (1 + encode_createmode_maxsz) |
139 | #define encode_claim_null_maxsz (1 + nfs4_name_maxsz) | 140 | #define encode_claim_null_maxsz (1 + nfs4_name_maxsz) |
140 | #define encode_open_maxsz (op_encode_hdr_maxsz + \ | 141 | #define encode_open_maxsz (op_encode_hdr_maxsz + \ |
@@ -299,6 +300,8 @@ static int nfs4_stat_to_errno(int); | |||
299 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) | 300 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) |
300 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ | 301 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ |
301 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) | 302 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) |
303 | #define encode_reclaim_complete_maxsz (op_encode_hdr_maxsz + 4) | ||
304 | #define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4) | ||
302 | #else /* CONFIG_NFS_V4_1 */ | 305 | #else /* CONFIG_NFS_V4_1 */ |
303 | #define encode_sequence_maxsz 0 | 306 | #define encode_sequence_maxsz 0 |
304 | #define decode_sequence_maxsz 0 | 307 | #define decode_sequence_maxsz 0 |
@@ -676,6 +679,25 @@ static int nfs4_stat_to_errno(int); | |||
676 | decode_sequence_maxsz + \ | 679 | decode_sequence_maxsz + \ |
677 | decode_putrootfh_maxsz + \ | 680 | decode_putrootfh_maxsz + \ |
678 | decode_fsinfo_maxsz) | 681 | decode_fsinfo_maxsz) |
682 | #define NFS4_enc_reclaim_complete_sz (compound_encode_hdr_maxsz + \ | ||
683 | encode_sequence_maxsz + \ | ||
684 | encode_reclaim_complete_maxsz) | ||
685 | #define NFS4_dec_reclaim_complete_sz (compound_decode_hdr_maxsz + \ | ||
686 | decode_sequence_maxsz + \ | ||
687 | decode_reclaim_complete_maxsz) | ||
688 | |||
689 | const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + | ||
690 | compound_encode_hdr_maxsz + | ||
691 | encode_sequence_maxsz + | ||
692 | encode_putfh_maxsz + | ||
693 | encode_getattr_maxsz) * | ||
694 | XDR_UNIT); | ||
695 | |||
696 | const u32 nfs41_maxread_overhead = ((RPC_MAX_HEADER_WITH_AUTH + | ||
697 | compound_decode_hdr_maxsz + | ||
698 | decode_sequence_maxsz + | ||
699 | decode_putfh_maxsz) * | ||
700 | XDR_UNIT); | ||
679 | #endif /* CONFIG_NFS_V4_1 */ | 701 | #endif /* CONFIG_NFS_V4_1 */ |
680 | 702 | ||
681 | static const umode_t nfs_type2fmt[] = { | 703 | static const umode_t nfs_type2fmt[] = { |
@@ -1140,6 +1162,7 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
1140 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 1162 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
1141 | { | 1163 | { |
1142 | __be32 *p; | 1164 | __be32 *p; |
1165 | struct nfs_client *clp; | ||
1143 | 1166 | ||
1144 | p = reserve_space(xdr, 4); | 1167 | p = reserve_space(xdr, 4); |
1145 | switch(arg->open_flags & O_EXCL) { | 1168 | switch(arg->open_flags & O_EXCL) { |
@@ -1148,8 +1171,23 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op | |||
1148 | encode_attrs(xdr, arg->u.attrs, arg->server); | 1171 | encode_attrs(xdr, arg->u.attrs, arg->server); |
1149 | break; | 1172 | break; |
1150 | default: | 1173 | default: |
1151 | *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE); | 1174 | clp = arg->server->nfs_client; |
1152 | encode_nfs4_verifier(xdr, &arg->u.verifier); | 1175 | if (clp->cl_minorversion > 0) { |
1176 | if (nfs4_has_persistent_session(clp)) { | ||
1177 | *p = cpu_to_be32(NFS4_CREATE_GUARDED); | ||
1178 | encode_attrs(xdr, arg->u.attrs, arg->server); | ||
1179 | } else { | ||
1180 | struct iattr dummy; | ||
1181 | |||
1182 | *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1); | ||
1183 | encode_nfs4_verifier(xdr, &arg->u.verifier); | ||
1184 | dummy.ia_valid = 0; | ||
1185 | encode_attrs(xdr, &dummy, arg->server); | ||
1186 | } | ||
1187 | } else { | ||
1188 | *p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE); | ||
1189 | encode_nfs4_verifier(xdr, &arg->u.verifier); | ||
1190 | } | ||
1153 | } | 1191 | } |
1154 | } | 1192 | } |
1155 | 1193 | ||
@@ -1539,6 +1577,14 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1539 | char machine_name[NFS4_MAX_MACHINE_NAME_LEN]; | 1577 | char machine_name[NFS4_MAX_MACHINE_NAME_LEN]; |
1540 | uint32_t len; | 1578 | uint32_t len; |
1541 | struct nfs_client *clp = args->client; | 1579 | struct nfs_client *clp = args->client; |
1580 | u32 max_resp_sz_cached; | ||
1581 | |||
1582 | /* | ||
1583 | * Assumes OPEN is the biggest non-idempotent compound. | ||
1584 | * 2 is the verifier. | ||
1585 | */ | ||
1586 | max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + | ||
1587 | RPC_MAX_AUTH_SIZE + 2) * XDR_UNIT; | ||
1542 | 1588 | ||
1543 | len = scnprintf(machine_name, sizeof(machine_name), "%s", | 1589 | len = scnprintf(machine_name, sizeof(machine_name), "%s", |
1544 | clp->cl_ipaddr); | 1590 | clp->cl_ipaddr); |
@@ -1553,7 +1599,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1553 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ | 1599 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ |
1554 | *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ | 1600 | *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ |
1555 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ | 1601 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ |
1556 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz_cached); /* Max resp sz cached */ | 1602 | *p++ = cpu_to_be32(max_resp_sz_cached); /* Max resp sz cached */ |
1557 | *p++ = cpu_to_be32(args->fc_attrs.max_ops); /* max operations */ | 1603 | *p++ = cpu_to_be32(args->fc_attrs.max_ops); /* max operations */ |
1558 | *p++ = cpu_to_be32(args->fc_attrs.max_reqs); /* max requests */ | 1604 | *p++ = cpu_to_be32(args->fc_attrs.max_reqs); /* max requests */ |
1559 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ | 1605 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ |
@@ -1592,6 +1638,19 @@ static void encode_destroy_session(struct xdr_stream *xdr, | |||
1592 | hdr->nops++; | 1638 | hdr->nops++; |
1593 | hdr->replen += decode_destroy_session_maxsz; | 1639 | hdr->replen += decode_destroy_session_maxsz; |
1594 | } | 1640 | } |
1641 | |||
1642 | static void encode_reclaim_complete(struct xdr_stream *xdr, | ||
1643 | struct nfs41_reclaim_complete_args *args, | ||
1644 | struct compound_hdr *hdr) | ||
1645 | { | ||
1646 | __be32 *p; | ||
1647 | |||
1648 | p = reserve_space(xdr, 8); | ||
1649 | *p++ = cpu_to_be32(OP_RECLAIM_COMPLETE); | ||
1650 | *p++ = cpu_to_be32(args->one_fs); | ||
1651 | hdr->nops++; | ||
1652 | hdr->replen += decode_reclaim_complete_maxsz; | ||
1653 | } | ||
1595 | #endif /* CONFIG_NFS_V4_1 */ | 1654 | #endif /* CONFIG_NFS_V4_1 */ |
1596 | 1655 | ||
1597 | static void encode_sequence(struct xdr_stream *xdr, | 1656 | static void encode_sequence(struct xdr_stream *xdr, |
@@ -2096,7 +2155,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, | |||
2096 | encode_compound_hdr(&xdr, req, &hdr); | 2155 | encode_compound_hdr(&xdr, req, &hdr); |
2097 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2156 | encode_sequence(&xdr, &args->seq_args, &hdr); |
2098 | encode_putfh(&xdr, args->fh, &hdr); | 2157 | encode_putfh(&xdr, args->fh, &hdr); |
2099 | replen = hdr.replen + nfs4_fattr_bitmap_maxsz + 1; | 2158 | replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1; |
2100 | encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr); | 2159 | encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr); |
2101 | 2160 | ||
2102 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, | 2161 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, |
@@ -2420,6 +2479,26 @@ static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p, | |||
2420 | encode_nops(&hdr); | 2479 | encode_nops(&hdr); |
2421 | return 0; | 2480 | return 0; |
2422 | } | 2481 | } |
2482 | |||
2483 | /* | ||
2484 | * a RECLAIM_COMPLETE request | ||
2485 | */ | ||
2486 | static int nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, uint32_t *p, | ||
2487 | struct nfs41_reclaim_complete_args *args) | ||
2488 | { | ||
2489 | struct xdr_stream xdr; | ||
2490 | struct compound_hdr hdr = { | ||
2491 | .minorversion = nfs4_xdr_minorversion(&args->seq_args) | ||
2492 | }; | ||
2493 | |||
2494 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
2495 | encode_compound_hdr(&xdr, req, &hdr); | ||
2496 | encode_sequence(&xdr, &args->seq_args, &hdr); | ||
2497 | encode_reclaim_complete(&xdr, args, &hdr); | ||
2498 | encode_nops(&hdr); | ||
2499 | return 0; | ||
2500 | } | ||
2501 | |||
2423 | #endif /* CONFIG_NFS_V4_1 */ | 2502 | #endif /* CONFIG_NFS_V4_1 */ |
2424 | 2503 | ||
2425 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) | 2504 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) |
@@ -4528,6 +4607,11 @@ static int decode_destroy_session(struct xdr_stream *xdr, void *dummy) | |||
4528 | { | 4607 | { |
4529 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); | 4608 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); |
4530 | } | 4609 | } |
4610 | |||
4611 | static int decode_reclaim_complete(struct xdr_stream *xdr, void *dummy) | ||
4612 | { | ||
4613 | return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE); | ||
4614 | } | ||
4531 | #endif /* CONFIG_NFS_V4_1 */ | 4615 | #endif /* CONFIG_NFS_V4_1 */ |
4532 | 4616 | ||
4533 | static int decode_sequence(struct xdr_stream *xdr, | 4617 | static int decode_sequence(struct xdr_stream *xdr, |
@@ -4554,7 +4638,7 @@ static int decode_sequence(struct xdr_stream *xdr, | |||
4554 | * If the server returns different values for sessionID, slotID or | 4638 | * If the server returns different values for sessionID, slotID or |
4555 | * sequence number, the server is looney tunes. | 4639 | * sequence number, the server is looney tunes. |
4556 | */ | 4640 | */ |
4557 | status = -ESERVERFAULT; | 4641 | status = -EREMOTEIO; |
4558 | 4642 | ||
4559 | if (memcmp(id.data, res->sr_session->sess_id.data, | 4643 | if (memcmp(id.data, res->sr_session->sess_id.data, |
4560 | NFS4_MAX_SESSIONID_LEN)) { | 4644 | NFS4_MAX_SESSIONID_LEN)) { |
@@ -4583,8 +4667,8 @@ static int decode_sequence(struct xdr_stream *xdr, | |||
4583 | dummy = be32_to_cpup(p++); | 4667 | dummy = be32_to_cpup(p++); |
4584 | /* target highest slot id - currently not processed */ | 4668 | /* target highest slot id - currently not processed */ |
4585 | dummy = be32_to_cpup(p++); | 4669 | dummy = be32_to_cpup(p++); |
4586 | /* result flags - currently not processed */ | 4670 | /* result flags */ |
4587 | dummy = be32_to_cpup(p); | 4671 | res->sr_status_flags = be32_to_cpup(p); |
4588 | status = 0; | 4672 | status = 0; |
4589 | out_err: | 4673 | out_err: |
4590 | res->sr_status = status; | 4674 | res->sr_status = status; |
@@ -5309,7 +5393,7 @@ out: | |||
5309 | } | 5393 | } |
5310 | 5394 | ||
5311 | /* | 5395 | /* |
5312 | * FSINFO request | 5396 | * Decode FSINFO response |
5313 | */ | 5397 | */ |
5314 | static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, | 5398 | static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, |
5315 | struct nfs4_fsinfo_res *res) | 5399 | struct nfs4_fsinfo_res *res) |
@@ -5330,7 +5414,7 @@ static int nfs4_xdr_dec_fsinfo(struct rpc_rqst *req, __be32 *p, | |||
5330 | } | 5414 | } |
5331 | 5415 | ||
5332 | /* | 5416 | /* |
5333 | * PATHCONF request | 5417 | * Decode PATHCONF response |
5334 | */ | 5418 | */ |
5335 | static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, | 5419 | static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, |
5336 | struct nfs4_pathconf_res *res) | 5420 | struct nfs4_pathconf_res *res) |
@@ -5351,7 +5435,7 @@ static int nfs4_xdr_dec_pathconf(struct rpc_rqst *req, __be32 *p, | |||
5351 | } | 5435 | } |
5352 | 5436 | ||
5353 | /* | 5437 | /* |
5354 | * STATFS request | 5438 | * Decode STATFS response |
5355 | */ | 5439 | */ |
5356 | static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, | 5440 | static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, |
5357 | struct nfs4_statfs_res *res) | 5441 | struct nfs4_statfs_res *res) |
@@ -5372,7 +5456,7 @@ static int nfs4_xdr_dec_statfs(struct rpc_rqst *req, __be32 *p, | |||
5372 | } | 5456 | } |
5373 | 5457 | ||
5374 | /* | 5458 | /* |
5375 | * GETATTR_BITMAP request | 5459 | * Decode GETATTR_BITMAP response |
5376 | */ | 5460 | */ |
5377 | static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res) | 5461 | static int nfs4_xdr_dec_server_caps(struct rpc_rqst *req, __be32 *p, struct nfs4_server_caps_res *res) |
5378 | { | 5462 | { |
@@ -5411,7 +5495,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy) | |||
5411 | } | 5495 | } |
5412 | 5496 | ||
5413 | /* | 5497 | /* |
5414 | * a SETCLIENTID request | 5498 | * Decode SETCLIENTID response |
5415 | */ | 5499 | */ |
5416 | static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, | 5500 | static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, |
5417 | struct nfs_client *clp) | 5501 | struct nfs_client *clp) |
@@ -5428,7 +5512,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, | |||
5428 | } | 5512 | } |
5429 | 5513 | ||
5430 | /* | 5514 | /* |
5431 | * a SETCLIENTID_CONFIRM request | 5515 | * Decode SETCLIENTID_CONFIRM response |
5432 | */ | 5516 | */ |
5433 | static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo) | 5517 | static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *fsinfo) |
5434 | { | 5518 | { |
@@ -5448,7 +5532,7 @@ static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str | |||
5448 | } | 5532 | } |
5449 | 5533 | ||
5450 | /* | 5534 | /* |
5451 | * DELEGRETURN request | 5535 | * Decode DELEGRETURN response |
5452 | */ | 5536 | */ |
5453 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res) | 5537 | static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_delegreturnres *res) |
5454 | { | 5538 | { |
@@ -5467,6 +5551,8 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nf | |||
5467 | if (status != 0) | 5551 | if (status != 0) |
5468 | goto out; | 5552 | goto out; |
5469 | status = decode_delegreturn(&xdr); | 5553 | status = decode_delegreturn(&xdr); |
5554 | if (status != 0) | ||
5555 | goto out; | ||
5470 | decode_getfattr(&xdr, res->fattr, res->server, | 5556 | decode_getfattr(&xdr, res->fattr, res->server, |
5471 | !RPC_IS_ASYNC(rqstp->rq_task)); | 5557 | !RPC_IS_ASYNC(rqstp->rq_task)); |
5472 | out: | 5558 | out: |
@@ -5474,7 +5560,7 @@ out: | |||
5474 | } | 5560 | } |
5475 | 5561 | ||
5476 | /* | 5562 | /* |
5477 | * FS_LOCATIONS request | 5563 | * Decode FS_LOCATIONS response |
5478 | */ | 5564 | */ |
5479 | static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, | 5565 | static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, |
5480 | struct nfs4_fs_locations_res *res) | 5566 | struct nfs4_fs_locations_res *res) |
@@ -5504,7 +5590,7 @@ out: | |||
5504 | 5590 | ||
5505 | #if defined(CONFIG_NFS_V4_1) | 5591 | #if defined(CONFIG_NFS_V4_1) |
5506 | /* | 5592 | /* |
5507 | * EXCHANGE_ID request | 5593 | * Decode EXCHANGE_ID response |
5508 | */ | 5594 | */ |
5509 | static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p, | 5595 | static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p, |
5510 | void *res) | 5596 | void *res) |
@@ -5521,7 +5607,7 @@ static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, uint32_t *p, | |||
5521 | } | 5607 | } |
5522 | 5608 | ||
5523 | /* | 5609 | /* |
5524 | * a CREATE_SESSION request | 5610 | * Decode CREATE_SESSION response |
5525 | */ | 5611 | */ |
5526 | static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p, | 5612 | static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p, |
5527 | struct nfs41_create_session_res *res) | 5613 | struct nfs41_create_session_res *res) |
@@ -5538,7 +5624,7 @@ static int nfs4_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p, | |||
5538 | } | 5624 | } |
5539 | 5625 | ||
5540 | /* | 5626 | /* |
5541 | * a DESTROY_SESSION request | 5627 | * Decode DESTROY_SESSION response |
5542 | */ | 5628 | */ |
5543 | static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p, | 5629 | static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p, |
5544 | void *dummy) | 5630 | void *dummy) |
@@ -5555,7 +5641,7 @@ static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, uint32_t *p, | |||
5555 | } | 5641 | } |
5556 | 5642 | ||
5557 | /* | 5643 | /* |
5558 | * a SEQUENCE request | 5644 | * Decode SEQUENCE response |
5559 | */ | 5645 | */ |
5560 | static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p, | 5646 | static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p, |
5561 | struct nfs4_sequence_res *res) | 5647 | struct nfs4_sequence_res *res) |
@@ -5572,7 +5658,7 @@ static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, uint32_t *p, | |||
5572 | } | 5658 | } |
5573 | 5659 | ||
5574 | /* | 5660 | /* |
5575 | * a GET_LEASE_TIME request | 5661 | * Decode GET_LEASE_TIME response |
5576 | */ | 5662 | */ |
5577 | static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, | 5663 | static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, |
5578 | struct nfs4_get_lease_time_res *res) | 5664 | struct nfs4_get_lease_time_res *res) |
@@ -5591,6 +5677,25 @@ static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, | |||
5591 | status = decode_fsinfo(&xdr, res->lr_fsinfo); | 5677 | status = decode_fsinfo(&xdr, res->lr_fsinfo); |
5592 | return status; | 5678 | return status; |
5593 | } | 5679 | } |
5680 | |||
5681 | /* | ||
5682 | * Decode RECLAIM_COMPLETE response | ||
5683 | */ | ||
5684 | static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp, uint32_t *p, | ||
5685 | struct nfs41_reclaim_complete_res *res) | ||
5686 | { | ||
5687 | struct xdr_stream xdr; | ||
5688 | struct compound_hdr hdr; | ||
5689 | int status; | ||
5690 | |||
5691 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | ||
5692 | status = decode_compound_hdr(&xdr, &hdr); | ||
5693 | if (!status) | ||
5694 | status = decode_sequence(&xdr, &res->seq_res, rqstp); | ||
5695 | if (!status) | ||
5696 | status = decode_reclaim_complete(&xdr, (void *)NULL); | ||
5697 | return status; | ||
5698 | } | ||
5594 | #endif /* CONFIG_NFS_V4_1 */ | 5699 | #endif /* CONFIG_NFS_V4_1 */ |
5595 | 5700 | ||
5596 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) | 5701 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
@@ -5678,7 +5783,7 @@ static struct { | |||
5678 | { NFS4ERR_BAD_COOKIE, -EBADCOOKIE }, | 5783 | { NFS4ERR_BAD_COOKIE, -EBADCOOKIE }, |
5679 | { NFS4ERR_NOTSUPP, -ENOTSUPP }, | 5784 | { NFS4ERR_NOTSUPP, -ENOTSUPP }, |
5680 | { NFS4ERR_TOOSMALL, -ETOOSMALL }, | 5785 | { NFS4ERR_TOOSMALL, -ETOOSMALL }, |
5681 | { NFS4ERR_SERVERFAULT, -ESERVERFAULT }, | 5786 | { NFS4ERR_SERVERFAULT, -EREMOTEIO }, |
5682 | { NFS4ERR_BADTYPE, -EBADTYPE }, | 5787 | { NFS4ERR_BADTYPE, -EBADTYPE }, |
5683 | { NFS4ERR_LOCKED, -EAGAIN }, | 5788 | { NFS4ERR_LOCKED, -EAGAIN }, |
5684 | { NFS4ERR_SYMLINK, -ELOOP }, | 5789 | { NFS4ERR_SYMLINK, -ELOOP }, |
@@ -5705,7 +5810,7 @@ nfs4_stat_to_errno(int stat) | |||
5705 | } | 5810 | } |
5706 | if (stat <= 10000 || stat > 10100) { | 5811 | if (stat <= 10000 || stat > 10100) { |
5707 | /* The server is looney tunes. */ | 5812 | /* The server is looney tunes. */ |
5708 | return -ESERVERFAULT; | 5813 | return -EREMOTEIO; |
5709 | } | 5814 | } |
5710 | /* If we cannot translate the error, the recovery routines should | 5815 | /* If we cannot translate the error, the recovery routines should |
5711 | * handle it. | 5816 | * handle it. |
@@ -5767,6 +5872,7 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
5767 | PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), | 5872 | PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), |
5768 | PROC(SEQUENCE, enc_sequence, dec_sequence), | 5873 | PROC(SEQUENCE, enc_sequence, dec_sequence), |
5769 | PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), | 5874 | PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), |
5875 | PROC(RECLAIM_COMPLETE, enc_reclaim_complete, dec_reclaim_complete), | ||
5770 | #endif /* CONFIG_NFS_V4_1 */ | 5876 | #endif /* CONFIG_NFS_V4_1 */ |
5771 | }; | 5877 | }; |
5772 | 5878 | ||