diff options
| -rw-r--r-- | fs/nfs/nfs4xdr.c | 66 | ||||
| -rw-r--r-- | include/linux/nfs4.h | 1 | ||||
| -rw-r--r-- | include/linux/nfs_xdr.h | 10 |
3 files changed, 77 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index bc8711d30296..e437fd6a819f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -301,6 +301,8 @@ static int nfs4_stat_to_errno(int); | |||
| 301 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) | 301 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) |
| 302 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ | 302 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ |
| 303 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) | 303 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) |
| 304 | #define encode_reclaim_complete_maxsz (op_encode_hdr_maxsz + 4) | ||
| 305 | #define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4) | ||
| 304 | #else /* CONFIG_NFS_V4_1 */ | 306 | #else /* CONFIG_NFS_V4_1 */ |
| 305 | #define encode_sequence_maxsz 0 | 307 | #define encode_sequence_maxsz 0 |
| 306 | #define decode_sequence_maxsz 0 | 308 | #define decode_sequence_maxsz 0 |
| @@ -678,6 +680,12 @@ static int nfs4_stat_to_errno(int); | |||
| 678 | decode_sequence_maxsz + \ | 680 | decode_sequence_maxsz + \ |
| 679 | decode_putrootfh_maxsz + \ | 681 | decode_putrootfh_maxsz + \ |
| 680 | decode_fsinfo_maxsz) | 682 | decode_fsinfo_maxsz) |
| 683 | #define NFS4_enc_reclaim_complete_sz (compound_encode_hdr_maxsz + \ | ||
| 684 | encode_sequence_maxsz + \ | ||
| 685 | encode_reclaim_complete_maxsz) | ||
| 686 | #define NFS4_dec_reclaim_complete_sz (compound_decode_hdr_maxsz + \ | ||
| 687 | decode_sequence_maxsz + \ | ||
| 688 | decode_reclaim_complete_maxsz) | ||
| 681 | 689 | ||
| 682 | const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + | 690 | const u32 nfs41_maxwrite_overhead = ((RPC_MAX_HEADER_WITH_AUTH + |
| 683 | compound_encode_hdr_maxsz + | 691 | compound_encode_hdr_maxsz + |
| @@ -1623,6 +1631,19 @@ static void encode_destroy_session(struct xdr_stream *xdr, | |||
| 1623 | hdr->nops++; | 1631 | hdr->nops++; |
| 1624 | hdr->replen += decode_destroy_session_maxsz; | 1632 | hdr->replen += decode_destroy_session_maxsz; |
| 1625 | } | 1633 | } |
| 1634 | |||
| 1635 | static void encode_reclaim_complete(struct xdr_stream *xdr, | ||
| 1636 | struct nfs41_reclaim_complete_args *args, | ||
| 1637 | struct compound_hdr *hdr) | ||
| 1638 | { | ||
| 1639 | __be32 *p; | ||
| 1640 | |||
| 1641 | p = reserve_space(xdr, 8); | ||
| 1642 | *p++ = cpu_to_be32(OP_RECLAIM_COMPLETE); | ||
| 1643 | *p++ = cpu_to_be32(args->one_fs); | ||
| 1644 | hdr->nops++; | ||
| 1645 | hdr->replen += decode_reclaim_complete_maxsz; | ||
| 1646 | } | ||
| 1626 | #endif /* CONFIG_NFS_V4_1 */ | 1647 | #endif /* CONFIG_NFS_V4_1 */ |
| 1627 | 1648 | ||
| 1628 | static void encode_sequence(struct xdr_stream *xdr, | 1649 | static void encode_sequence(struct xdr_stream *xdr, |
| @@ -2451,6 +2472,26 @@ static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p, | |||
| 2451 | encode_nops(&hdr); | 2472 | encode_nops(&hdr); |
| 2452 | return 0; | 2473 | return 0; |
| 2453 | } | 2474 | } |
| 2475 | |||
| 2476 | /* | ||
| 2477 | * a RECLAIM_COMPLETE request | ||
| 2478 | */ | ||
| 2479 | static int nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, uint32_t *p, | ||
| 2480 | struct nfs41_reclaim_complete_args *args) | ||
| 2481 | { | ||
| 2482 | struct xdr_stream xdr; | ||
| 2483 | struct compound_hdr hdr = { | ||
| 2484 | .minorversion = nfs4_xdr_minorversion(&args->seq_args) | ||
| 2485 | }; | ||
| 2486 | |||
| 2487 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
| 2488 | encode_compound_hdr(&xdr, req, &hdr); | ||
| 2489 | encode_sequence(&xdr, &args->seq_args, &hdr); | ||
| 2490 | encode_reclaim_complete(&xdr, args, &hdr); | ||
| 2491 | encode_nops(&hdr); | ||
| 2492 | return 0; | ||
| 2493 | } | ||
| 2494 | |||
| 2454 | #endif /* CONFIG_NFS_V4_1 */ | 2495 | #endif /* CONFIG_NFS_V4_1 */ |
| 2455 | 2496 | ||
| 2456 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) | 2497 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) |
| @@ -4559,6 +4600,11 @@ static int decode_destroy_session(struct xdr_stream *xdr, void *dummy) | |||
| 4559 | { | 4600 | { |
| 4560 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); | 4601 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); |
| 4561 | } | 4602 | } |
| 4603 | |||
| 4604 | static int decode_reclaim_complete(struct xdr_stream *xdr, void *dummy) | ||
| 4605 | { | ||
| 4606 | return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE); | ||
| 4607 | } | ||
| 4562 | #endif /* CONFIG_NFS_V4_1 */ | 4608 | #endif /* CONFIG_NFS_V4_1 */ |
| 4563 | 4609 | ||
| 4564 | static int decode_sequence(struct xdr_stream *xdr, | 4610 | static int decode_sequence(struct xdr_stream *xdr, |
| @@ -5622,6 +5668,25 @@ static int nfs4_xdr_dec_get_lease_time(struct rpc_rqst *rqstp, uint32_t *p, | |||
| 5622 | status = decode_fsinfo(&xdr, res->lr_fsinfo); | 5668 | status = decode_fsinfo(&xdr, res->lr_fsinfo); |
| 5623 | return status; | 5669 | return status; |
| 5624 | } | 5670 | } |
| 5671 | |||
| 5672 | /* | ||
| 5673 | * Decode RECLAIM_COMPLETE response | ||
| 5674 | */ | ||
| 5675 | static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp, uint32_t *p, | ||
| 5676 | struct nfs41_reclaim_complete_res *res) | ||
| 5677 | { | ||
| 5678 | struct xdr_stream xdr; | ||
| 5679 | struct compound_hdr hdr; | ||
| 5680 | int status; | ||
| 5681 | |||
| 5682 | xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); | ||
| 5683 | status = decode_compound_hdr(&xdr, &hdr); | ||
| 5684 | if (!status) | ||
| 5685 | status = decode_sequence(&xdr, &res->seq_res, rqstp); | ||
| 5686 | if (!status) | ||
| 5687 | status = decode_reclaim_complete(&xdr, (void *)NULL); | ||
| 5688 | return status; | ||
| 5689 | } | ||
| 5625 | #endif /* CONFIG_NFS_V4_1 */ | 5690 | #endif /* CONFIG_NFS_V4_1 */ |
| 5626 | 5691 | ||
| 5627 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) | 5692 | __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) |
| @@ -5798,6 +5863,7 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
| 5798 | PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), | 5863 | PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), |
| 5799 | PROC(SEQUENCE, enc_sequence, dec_sequence), | 5864 | PROC(SEQUENCE, enc_sequence, dec_sequence), |
| 5800 | PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), | 5865 | PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), |
| 5866 | PROC(RECLAIM_COMPLETE, enc_reclaim_complete, dec_reclaim_complete), | ||
| 5801 | #endif /* CONFIG_NFS_V4_1 */ | 5867 | #endif /* CONFIG_NFS_V4_1 */ |
| 5802 | }; | 5868 | }; |
| 5803 | 5869 | ||
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 89404bfb72b6..9b8299af3741 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -530,6 +530,7 @@ enum { | |||
| 530 | NFSPROC4_CLNT_DESTROY_SESSION, | 530 | NFSPROC4_CLNT_DESTROY_SESSION, |
| 531 | NFSPROC4_CLNT_SEQUENCE, | 531 | NFSPROC4_CLNT_SEQUENCE, |
| 532 | NFSPROC4_CLNT_GET_LEASE_TIME, | 532 | NFSPROC4_CLNT_GET_LEASE_TIME, |
| 533 | NFSPROC4_CLNT_RECLAIM_COMPLETE, | ||
| 533 | }; | 534 | }; |
| 534 | 535 | ||
| 535 | /* nfs41 types */ | 536 | /* nfs41 types */ |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index ea32db30c289..51071b335751 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -939,6 +939,16 @@ struct nfs41_create_session_args { | |||
| 939 | struct nfs41_create_session_res { | 939 | struct nfs41_create_session_res { |
| 940 | struct nfs_client *client; | 940 | struct nfs_client *client; |
| 941 | }; | 941 | }; |
| 942 | |||
| 943 | struct nfs41_reclaim_complete_args { | ||
| 944 | /* In the future extend to include curr_fh for use with migration */ | ||
| 945 | unsigned char one_fs:1; | ||
| 946 | struct nfs4_sequence_args seq_args; | ||
| 947 | }; | ||
| 948 | |||
| 949 | struct nfs41_reclaim_complete_res { | ||
| 950 | struct nfs4_sequence_res seq_res; | ||
| 951 | }; | ||
| 942 | #endif /* CONFIG_NFS_V4_1 */ | 952 | #endif /* CONFIG_NFS_V4_1 */ |
| 943 | 953 | ||
| 944 | struct nfs_page; | 954 | struct nfs_page; |
