diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 404 |
1 files changed, 306 insertions, 98 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c54aae364bee..18fae29b0301 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -53,9 +53,11 @@ | |||
53 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
54 | #include <linux/nfs_fs.h> | 54 | #include <linux/nfs_fs.h> |
55 | #include <linux/nfs_idmap.h> | 55 | #include <linux/nfs_idmap.h> |
56 | |||
56 | #include "nfs4_fs.h" | 57 | #include "nfs4_fs.h" |
57 | #include "internal.h" | 58 | #include "internal.h" |
58 | #include "pnfs.h" | 59 | #include "pnfs.h" |
60 | #include "netns.h" | ||
59 | 61 | ||
60 | #define NFSDBG_FACILITY NFSDBG_XDR | 62 | #define NFSDBG_FACILITY NFSDBG_XDR |
61 | 63 | ||
@@ -99,9 +101,12 @@ static int nfs4_stat_to_errno(int); | |||
99 | #define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) | 101 | #define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) |
100 | #define nfs4_owner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) | 102 | #define nfs4_owner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) |
101 | #define nfs4_group_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) | 103 | #define nfs4_group_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) |
104 | /* We support only one layout type per file system */ | ||
105 | #define decode_mdsthreshold_maxsz (1 + 1 + nfs4_fattr_bitmap_maxsz + 1 + 8) | ||
102 | /* This is based on getfattr, which uses the most attributes: */ | 106 | /* This is based on getfattr, which uses the most attributes: */ |
103 | #define nfs4_fattr_value_maxsz (1 + (1 + 2 + 2 + 4 + 2 + 1 + 1 + 2 + 2 + \ | 107 | #define nfs4_fattr_value_maxsz (1 + (1 + 2 + 2 + 4 + 2 + 1 + 1 + 2 + 2 + \ |
104 | 3 + 3 + 3 + nfs4_owner_maxsz + nfs4_group_maxsz)) | 108 | 3 + 3 + 3 + nfs4_owner_maxsz + \ |
109 | nfs4_group_maxsz + decode_mdsthreshold_maxsz)) | ||
105 | #define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \ | 110 | #define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \ |
106 | nfs4_fattr_value_maxsz) | 111 | nfs4_fattr_value_maxsz) |
107 | #define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) | 112 | #define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) |
@@ -321,8 +326,20 @@ static int nfs4_stat_to_errno(int); | |||
321 | 1 /* csr_flags */ + \ | 326 | 1 /* csr_flags */ + \ |
322 | decode_channel_attrs_maxsz + \ | 327 | decode_channel_attrs_maxsz + \ |
323 | decode_channel_attrs_maxsz) | 328 | decode_channel_attrs_maxsz) |
329 | #define encode_bind_conn_to_session_maxsz (op_encode_hdr_maxsz + \ | ||
330 | /* bctsa_sessid */ \ | ||
331 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + \ | ||
332 | 1 /* bctsa_dir */ + \ | ||
333 | 1 /* bctsa_use_conn_in_rdma_mode */) | ||
334 | #define decode_bind_conn_to_session_maxsz (op_decode_hdr_maxsz + \ | ||
335 | /* bctsr_sessid */ \ | ||
336 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + \ | ||
337 | 1 /* bctsr_dir */ + \ | ||
338 | 1 /* bctsr_use_conn_in_rdma_mode */) | ||
324 | #define encode_destroy_session_maxsz (op_encode_hdr_maxsz + 4) | 339 | #define encode_destroy_session_maxsz (op_encode_hdr_maxsz + 4) |
325 | #define decode_destroy_session_maxsz (op_decode_hdr_maxsz) | 340 | #define decode_destroy_session_maxsz (op_decode_hdr_maxsz) |
341 | #define encode_destroy_clientid_maxsz (op_encode_hdr_maxsz + 2) | ||
342 | #define decode_destroy_clientid_maxsz (op_decode_hdr_maxsz) | ||
326 | #define encode_sequence_maxsz (op_encode_hdr_maxsz + \ | 343 | #define encode_sequence_maxsz (op_encode_hdr_maxsz + \ |
327 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) | 344 | XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 4) |
328 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ | 345 | #define decode_sequence_maxsz (op_decode_hdr_maxsz + \ |
@@ -421,30 +438,22 @@ static int nfs4_stat_to_errno(int); | |||
421 | #define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \ | 438 | #define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \ |
422 | encode_sequence_maxsz + \ | 439 | encode_sequence_maxsz + \ |
423 | encode_putfh_maxsz + \ | 440 | encode_putfh_maxsz + \ |
424 | encode_commit_maxsz + \ | 441 | encode_commit_maxsz) |
425 | encode_getattr_maxsz) | ||
426 | #define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \ | 442 | #define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \ |
427 | decode_sequence_maxsz + \ | 443 | decode_sequence_maxsz + \ |
428 | decode_putfh_maxsz + \ | 444 | decode_putfh_maxsz + \ |
429 | decode_commit_maxsz + \ | 445 | decode_commit_maxsz) |
430 | decode_getattr_maxsz) | ||
431 | #define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ | 446 | #define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ |
432 | encode_sequence_maxsz + \ | 447 | encode_sequence_maxsz + \ |
433 | encode_putfh_maxsz + \ | 448 | encode_putfh_maxsz + \ |
434 | encode_savefh_maxsz + \ | ||
435 | encode_open_maxsz + \ | 449 | encode_open_maxsz + \ |
436 | encode_getfh_maxsz + \ | 450 | encode_getfh_maxsz + \ |
437 | encode_getattr_maxsz + \ | ||
438 | encode_restorefh_maxsz + \ | ||
439 | encode_getattr_maxsz) | 451 | encode_getattr_maxsz) |
440 | #define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ | 452 | #define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ |
441 | decode_sequence_maxsz + \ | 453 | decode_sequence_maxsz + \ |
442 | decode_putfh_maxsz + \ | 454 | decode_putfh_maxsz + \ |
443 | decode_savefh_maxsz + \ | ||
444 | decode_open_maxsz + \ | 455 | decode_open_maxsz + \ |
445 | decode_getfh_maxsz + \ | 456 | decode_getfh_maxsz + \ |
446 | decode_getattr_maxsz + \ | ||
447 | decode_restorefh_maxsz + \ | ||
448 | decode_getattr_maxsz) | 457 | decode_getattr_maxsz) |
449 | #define NFS4_enc_open_confirm_sz \ | 458 | #define NFS4_enc_open_confirm_sz \ |
450 | (compound_encode_hdr_maxsz + \ | 459 | (compound_encode_hdr_maxsz + \ |
@@ -595,47 +604,37 @@ static int nfs4_stat_to_errno(int); | |||
595 | #define NFS4_enc_remove_sz (compound_encode_hdr_maxsz + \ | 604 | #define NFS4_enc_remove_sz (compound_encode_hdr_maxsz + \ |
596 | encode_sequence_maxsz + \ | 605 | encode_sequence_maxsz + \ |
597 | encode_putfh_maxsz + \ | 606 | encode_putfh_maxsz + \ |
598 | encode_remove_maxsz + \ | 607 | encode_remove_maxsz) |
599 | encode_getattr_maxsz) | ||
600 | #define NFS4_dec_remove_sz (compound_decode_hdr_maxsz + \ | 608 | #define NFS4_dec_remove_sz (compound_decode_hdr_maxsz + \ |
601 | decode_sequence_maxsz + \ | 609 | decode_sequence_maxsz + \ |
602 | decode_putfh_maxsz + \ | 610 | decode_putfh_maxsz + \ |
603 | decode_remove_maxsz + \ | 611 | decode_remove_maxsz) |
604 | decode_getattr_maxsz) | ||
605 | #define NFS4_enc_rename_sz (compound_encode_hdr_maxsz + \ | 612 | #define NFS4_enc_rename_sz (compound_encode_hdr_maxsz + \ |
606 | encode_sequence_maxsz + \ | 613 | encode_sequence_maxsz + \ |
607 | encode_putfh_maxsz + \ | 614 | encode_putfh_maxsz + \ |
608 | encode_savefh_maxsz + \ | 615 | encode_savefh_maxsz + \ |
609 | encode_putfh_maxsz + \ | 616 | encode_putfh_maxsz + \ |
610 | encode_rename_maxsz + \ | 617 | encode_rename_maxsz) |
611 | encode_getattr_maxsz + \ | ||
612 | encode_restorefh_maxsz + \ | ||
613 | encode_getattr_maxsz) | ||
614 | #define NFS4_dec_rename_sz (compound_decode_hdr_maxsz + \ | 618 | #define NFS4_dec_rename_sz (compound_decode_hdr_maxsz + \ |
615 | decode_sequence_maxsz + \ | 619 | decode_sequence_maxsz + \ |
616 | decode_putfh_maxsz + \ | 620 | decode_putfh_maxsz + \ |
617 | decode_savefh_maxsz + \ | 621 | decode_savefh_maxsz + \ |
618 | decode_putfh_maxsz + \ | 622 | decode_putfh_maxsz + \ |
619 | decode_rename_maxsz + \ | 623 | decode_rename_maxsz) |
620 | decode_getattr_maxsz + \ | ||
621 | decode_restorefh_maxsz + \ | ||
622 | decode_getattr_maxsz) | ||
623 | #define NFS4_enc_link_sz (compound_encode_hdr_maxsz + \ | 624 | #define NFS4_enc_link_sz (compound_encode_hdr_maxsz + \ |
624 | encode_sequence_maxsz + \ | 625 | encode_sequence_maxsz + \ |
625 | encode_putfh_maxsz + \ | 626 | encode_putfh_maxsz + \ |
626 | encode_savefh_maxsz + \ | 627 | encode_savefh_maxsz + \ |
627 | encode_putfh_maxsz + \ | 628 | encode_putfh_maxsz + \ |
628 | encode_link_maxsz + \ | 629 | encode_link_maxsz + \ |
629 | decode_getattr_maxsz + \ | ||
630 | encode_restorefh_maxsz + \ | 630 | encode_restorefh_maxsz + \ |
631 | decode_getattr_maxsz) | 631 | encode_getattr_maxsz) |
632 | #define NFS4_dec_link_sz (compound_decode_hdr_maxsz + \ | 632 | #define NFS4_dec_link_sz (compound_decode_hdr_maxsz + \ |
633 | decode_sequence_maxsz + \ | 633 | decode_sequence_maxsz + \ |
634 | decode_putfh_maxsz + \ | 634 | decode_putfh_maxsz + \ |
635 | decode_savefh_maxsz + \ | 635 | decode_savefh_maxsz + \ |
636 | decode_putfh_maxsz + \ | 636 | decode_putfh_maxsz + \ |
637 | decode_link_maxsz + \ | 637 | decode_link_maxsz + \ |
638 | decode_getattr_maxsz + \ | ||
639 | decode_restorefh_maxsz + \ | 638 | decode_restorefh_maxsz + \ |
640 | decode_getattr_maxsz) | 639 | decode_getattr_maxsz) |
641 | #define NFS4_enc_symlink_sz (compound_encode_hdr_maxsz + \ | 640 | #define NFS4_enc_symlink_sz (compound_encode_hdr_maxsz + \ |
@@ -653,20 +652,14 @@ static int nfs4_stat_to_errno(int); | |||
653 | #define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \ | 652 | #define NFS4_enc_create_sz (compound_encode_hdr_maxsz + \ |
654 | encode_sequence_maxsz + \ | 653 | encode_sequence_maxsz + \ |
655 | encode_putfh_maxsz + \ | 654 | encode_putfh_maxsz + \ |
656 | encode_savefh_maxsz + \ | ||
657 | encode_create_maxsz + \ | 655 | encode_create_maxsz + \ |
658 | encode_getfh_maxsz + \ | 656 | encode_getfh_maxsz + \ |
659 | encode_getattr_maxsz + \ | ||
660 | encode_restorefh_maxsz + \ | ||
661 | encode_getattr_maxsz) | 657 | encode_getattr_maxsz) |
662 | #define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \ | 658 | #define NFS4_dec_create_sz (compound_decode_hdr_maxsz + \ |
663 | decode_sequence_maxsz + \ | 659 | decode_sequence_maxsz + \ |
664 | decode_putfh_maxsz + \ | 660 | decode_putfh_maxsz + \ |
665 | decode_savefh_maxsz + \ | ||
666 | decode_create_maxsz + \ | 661 | decode_create_maxsz + \ |
667 | decode_getfh_maxsz + \ | 662 | decode_getfh_maxsz + \ |
668 | decode_getattr_maxsz + \ | ||
669 | decode_restorefh_maxsz + \ | ||
670 | decode_getattr_maxsz) | 663 | decode_getattr_maxsz) |
671 | #define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \ | 664 | #define NFS4_enc_pathconf_sz (compound_encode_hdr_maxsz + \ |
672 | encode_sequence_maxsz + \ | 665 | encode_sequence_maxsz + \ |
@@ -738,6 +731,12 @@ static int nfs4_stat_to_errno(int); | |||
738 | decode_putfh_maxsz + \ | 731 | decode_putfh_maxsz + \ |
739 | decode_secinfo_maxsz) | 732 | decode_secinfo_maxsz) |
740 | #if defined(CONFIG_NFS_V4_1) | 733 | #if defined(CONFIG_NFS_V4_1) |
734 | #define NFS4_enc_bind_conn_to_session_sz \ | ||
735 | (compound_encode_hdr_maxsz + \ | ||
736 | encode_bind_conn_to_session_maxsz) | ||
737 | #define NFS4_dec_bind_conn_to_session_sz \ | ||
738 | (compound_decode_hdr_maxsz + \ | ||
739 | decode_bind_conn_to_session_maxsz) | ||
741 | #define NFS4_enc_exchange_id_sz \ | 740 | #define NFS4_enc_exchange_id_sz \ |
742 | (compound_encode_hdr_maxsz + \ | 741 | (compound_encode_hdr_maxsz + \ |
743 | encode_exchange_id_maxsz) | 742 | encode_exchange_id_maxsz) |
@@ -754,6 +753,10 @@ static int nfs4_stat_to_errno(int); | |||
754 | encode_destroy_session_maxsz) | 753 | encode_destroy_session_maxsz) |
755 | #define NFS4_dec_destroy_session_sz (compound_decode_hdr_maxsz + \ | 754 | #define NFS4_dec_destroy_session_sz (compound_decode_hdr_maxsz + \ |
756 | decode_destroy_session_maxsz) | 755 | decode_destroy_session_maxsz) |
756 | #define NFS4_enc_destroy_clientid_sz (compound_encode_hdr_maxsz + \ | ||
757 | encode_destroy_clientid_maxsz) | ||
758 | #define NFS4_dec_destroy_clientid_sz (compound_decode_hdr_maxsz + \ | ||
759 | decode_destroy_clientid_maxsz) | ||
757 | #define NFS4_enc_sequence_sz \ | 760 | #define NFS4_enc_sequence_sz \ |
758 | (compound_decode_hdr_maxsz + \ | 761 | (compound_decode_hdr_maxsz + \ |
759 | encode_sequence_maxsz) | 762 | encode_sequence_maxsz) |
@@ -1103,7 +1106,7 @@ static void encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg | |||
1103 | encode_nfs4_stateid(xdr, arg->stateid); | 1106 | encode_nfs4_stateid(xdr, arg->stateid); |
1104 | } | 1107 | } |
1105 | 1108 | ||
1106 | static void encode_commit(struct xdr_stream *xdr, const struct nfs_writeargs *args, struct compound_hdr *hdr) | 1109 | static void encode_commit(struct xdr_stream *xdr, const struct nfs_commitargs *args, struct compound_hdr *hdr) |
1107 | { | 1110 | { |
1108 | __be32 *p; | 1111 | __be32 *p; |
1109 | 1112 | ||
@@ -1194,6 +1197,17 @@ static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct c | |||
1194 | bitmask[1] & nfs4_fattr_bitmap[1], hdr); | 1197 | bitmask[1] & nfs4_fattr_bitmap[1], hdr); |
1195 | } | 1198 | } |
1196 | 1199 | ||
1200 | static void encode_getfattr_open(struct xdr_stream *xdr, const u32 *bitmask, | ||
1201 | const u32 *open_bitmap, | ||
1202 | struct compound_hdr *hdr) | ||
1203 | { | ||
1204 | encode_getattr_three(xdr, | ||
1205 | bitmask[0] & open_bitmap[0], | ||
1206 | bitmask[1] & open_bitmap[1], | ||
1207 | bitmask[2] & open_bitmap[2], | ||
1208 | hdr); | ||
1209 | } | ||
1210 | |||
1197 | static void encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) | 1211 | static void encode_fsinfo(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) |
1198 | { | 1212 | { |
1199 | encode_getattr_three(xdr, | 1213 | encode_getattr_three(xdr, |
@@ -1678,6 +1692,20 @@ static void encode_secinfo(struct xdr_stream *xdr, const struct qstr *name, stru | |||
1678 | 1692 | ||
1679 | #if defined(CONFIG_NFS_V4_1) | 1693 | #if defined(CONFIG_NFS_V4_1) |
1680 | /* NFSv4.1 operations */ | 1694 | /* NFSv4.1 operations */ |
1695 | static void encode_bind_conn_to_session(struct xdr_stream *xdr, | ||
1696 | struct nfs4_session *session, | ||
1697 | struct compound_hdr *hdr) | ||
1698 | { | ||
1699 | __be32 *p; | ||
1700 | |||
1701 | encode_op_hdr(xdr, OP_BIND_CONN_TO_SESSION, | ||
1702 | decode_bind_conn_to_session_maxsz, hdr); | ||
1703 | encode_opaque_fixed(xdr, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); | ||
1704 | p = xdr_reserve_space(xdr, 8); | ||
1705 | *p++ = cpu_to_be32(NFS4_CDFC4_BACK_OR_BOTH); | ||
1706 | *p = 0; /* use_conn_in_rdma_mode = False */ | ||
1707 | } | ||
1708 | |||
1681 | static void encode_exchange_id(struct xdr_stream *xdr, | 1709 | static void encode_exchange_id(struct xdr_stream *xdr, |
1682 | struct nfs41_exchange_id_args *args, | 1710 | struct nfs41_exchange_id_args *args, |
1683 | struct compound_hdr *hdr) | 1711 | struct compound_hdr *hdr) |
@@ -1726,6 +1754,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1726 | char machine_name[NFS4_MAX_MACHINE_NAME_LEN]; | 1754 | char machine_name[NFS4_MAX_MACHINE_NAME_LEN]; |
1727 | uint32_t len; | 1755 | uint32_t len; |
1728 | struct nfs_client *clp = args->client; | 1756 | struct nfs_client *clp = args->client; |
1757 | struct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id); | ||
1729 | u32 max_resp_sz_cached; | 1758 | u32 max_resp_sz_cached; |
1730 | 1759 | ||
1731 | /* | 1760 | /* |
@@ -1767,7 +1796,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1767 | *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */ | 1796 | *p++ = cpu_to_be32(RPC_AUTH_UNIX); /* auth_sys */ |
1768 | 1797 | ||
1769 | /* authsys_parms rfc1831 */ | 1798 | /* authsys_parms rfc1831 */ |
1770 | *p++ = cpu_to_be32((u32)clp->cl_boot_time.tv_nsec); /* stamp */ | 1799 | *p++ = (__be32)nn->boot_time.tv_nsec; /* stamp */ |
1771 | p = xdr_encode_opaque(p, machine_name, len); | 1800 | p = xdr_encode_opaque(p, machine_name, len); |
1772 | *p++ = cpu_to_be32(0); /* UID */ | 1801 | *p++ = cpu_to_be32(0); /* UID */ |
1773 | *p++ = cpu_to_be32(0); /* GID */ | 1802 | *p++ = cpu_to_be32(0); /* GID */ |
@@ -1782,6 +1811,14 @@ static void encode_destroy_session(struct xdr_stream *xdr, | |||
1782 | encode_opaque_fixed(xdr, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); | 1811 | encode_opaque_fixed(xdr, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); |
1783 | } | 1812 | } |
1784 | 1813 | ||
1814 | static void encode_destroy_clientid(struct xdr_stream *xdr, | ||
1815 | uint64_t clientid, | ||
1816 | struct compound_hdr *hdr) | ||
1817 | { | ||
1818 | encode_op_hdr(xdr, OP_DESTROY_CLIENTID, decode_destroy_clientid_maxsz, hdr); | ||
1819 | encode_uint64(xdr, clientid); | ||
1820 | } | ||
1821 | |||
1785 | static void encode_reclaim_complete(struct xdr_stream *xdr, | 1822 | static void encode_reclaim_complete(struct xdr_stream *xdr, |
1786 | struct nfs41_reclaim_complete_args *args, | 1823 | struct nfs41_reclaim_complete_args *args, |
1787 | struct compound_hdr *hdr) | 1824 | struct compound_hdr *hdr) |
@@ -2064,7 +2101,6 @@ static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2064 | encode_sequence(xdr, &args->seq_args, &hdr); | 2101 | encode_sequence(xdr, &args->seq_args, &hdr); |
2065 | encode_putfh(xdr, args->fh, &hdr); | 2102 | encode_putfh(xdr, args->fh, &hdr); |
2066 | encode_remove(xdr, &args->name, &hdr); | 2103 | encode_remove(xdr, &args->name, &hdr); |
2067 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2068 | encode_nops(&hdr); | 2104 | encode_nops(&hdr); |
2069 | } | 2105 | } |
2070 | 2106 | ||
@@ -2084,9 +2120,6 @@ static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2084 | encode_savefh(xdr, &hdr); | 2120 | encode_savefh(xdr, &hdr); |
2085 | encode_putfh(xdr, args->new_dir, &hdr); | 2121 | encode_putfh(xdr, args->new_dir, &hdr); |
2086 | encode_rename(xdr, args->old_name, args->new_name, &hdr); | 2122 | encode_rename(xdr, args->old_name, args->new_name, &hdr); |
2087 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2088 | encode_restorefh(xdr, &hdr); | ||
2089 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2090 | encode_nops(&hdr); | 2123 | encode_nops(&hdr); |
2091 | } | 2124 | } |
2092 | 2125 | ||
@@ -2106,7 +2139,6 @@ static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2106 | encode_savefh(xdr, &hdr); | 2139 | encode_savefh(xdr, &hdr); |
2107 | encode_putfh(xdr, args->dir_fh, &hdr); | 2140 | encode_putfh(xdr, args->dir_fh, &hdr); |
2108 | encode_link(xdr, args->name, &hdr); | 2141 | encode_link(xdr, args->name, &hdr); |
2109 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2110 | encode_restorefh(xdr, &hdr); | 2142 | encode_restorefh(xdr, &hdr); |
2111 | encode_getfattr(xdr, args->bitmask, &hdr); | 2143 | encode_getfattr(xdr, args->bitmask, &hdr); |
2112 | encode_nops(&hdr); | 2144 | encode_nops(&hdr); |
@@ -2125,12 +2157,9 @@ static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2125 | encode_compound_hdr(xdr, req, &hdr); | 2157 | encode_compound_hdr(xdr, req, &hdr); |
2126 | encode_sequence(xdr, &args->seq_args, &hdr); | 2158 | encode_sequence(xdr, &args->seq_args, &hdr); |
2127 | encode_putfh(xdr, args->dir_fh, &hdr); | 2159 | encode_putfh(xdr, args->dir_fh, &hdr); |
2128 | encode_savefh(xdr, &hdr); | ||
2129 | encode_create(xdr, args, &hdr); | 2160 | encode_create(xdr, args, &hdr); |
2130 | encode_getfh(xdr, &hdr); | 2161 | encode_getfh(xdr, &hdr); |
2131 | encode_getfattr(xdr, args->bitmask, &hdr); | 2162 | encode_getfattr(xdr, args->bitmask, &hdr); |
2132 | encode_restorefh(xdr, &hdr); | ||
2133 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2134 | encode_nops(&hdr); | 2163 | encode_nops(&hdr); |
2135 | } | 2164 | } |
2136 | 2165 | ||
@@ -2191,12 +2220,9 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2191 | encode_compound_hdr(xdr, req, &hdr); | 2220 | encode_compound_hdr(xdr, req, &hdr); |
2192 | encode_sequence(xdr, &args->seq_args, &hdr); | 2221 | encode_sequence(xdr, &args->seq_args, &hdr); |
2193 | encode_putfh(xdr, args->fh, &hdr); | 2222 | encode_putfh(xdr, args->fh, &hdr); |
2194 | encode_savefh(xdr, &hdr); | ||
2195 | encode_open(xdr, args, &hdr); | 2223 | encode_open(xdr, args, &hdr); |
2196 | encode_getfh(xdr, &hdr); | 2224 | encode_getfh(xdr, &hdr); |
2197 | encode_getfattr(xdr, args->bitmask, &hdr); | 2225 | encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); |
2198 | encode_restorefh(xdr, &hdr); | ||
2199 | encode_getfattr(xdr, args->dir_bitmask, &hdr); | ||
2200 | encode_nops(&hdr); | 2226 | encode_nops(&hdr); |
2201 | } | 2227 | } |
2202 | 2228 | ||
@@ -2448,7 +2474,7 @@ static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2448 | * a COMMIT request | 2474 | * a COMMIT request |
2449 | */ | 2475 | */ |
2450 | static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, | 2476 | static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, |
2451 | struct nfs_writeargs *args) | 2477 | struct nfs_commitargs *args) |
2452 | { | 2478 | { |
2453 | struct compound_hdr hdr = { | 2479 | struct compound_hdr hdr = { |
2454 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2480 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
@@ -2458,8 +2484,6 @@ static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2458 | encode_sequence(xdr, &args->seq_args, &hdr); | 2484 | encode_sequence(xdr, &args->seq_args, &hdr); |
2459 | encode_putfh(xdr, args->fh, &hdr); | 2485 | encode_putfh(xdr, args->fh, &hdr); |
2460 | encode_commit(xdr, args, &hdr); | 2486 | encode_commit(xdr, args, &hdr); |
2461 | if (args->bitmask) | ||
2462 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2463 | encode_nops(&hdr); | 2487 | encode_nops(&hdr); |
2464 | } | 2488 | } |
2465 | 2489 | ||
@@ -2602,8 +2626,8 @@ static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, | |||
2602 | encode_compound_hdr(xdr, req, &hdr); | 2626 | encode_compound_hdr(xdr, req, &hdr); |
2603 | encode_sequence(xdr, &args->seq_args, &hdr); | 2627 | encode_sequence(xdr, &args->seq_args, &hdr); |
2604 | encode_putfh(xdr, args->fhandle, &hdr); | 2628 | encode_putfh(xdr, args->fhandle, &hdr); |
2605 | encode_delegreturn(xdr, args->stateid, &hdr); | ||
2606 | encode_getfattr(xdr, args->bitmask, &hdr); | 2629 | encode_getfattr(xdr, args->bitmask, &hdr); |
2630 | encode_delegreturn(xdr, args->stateid, &hdr); | ||
2607 | encode_nops(&hdr); | 2631 | encode_nops(&hdr); |
2608 | } | 2632 | } |
2609 | 2633 | ||
@@ -2651,6 +2675,22 @@ static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req, | |||
2651 | 2675 | ||
2652 | #if defined(CONFIG_NFS_V4_1) | 2676 | #if defined(CONFIG_NFS_V4_1) |
2653 | /* | 2677 | /* |
2678 | * BIND_CONN_TO_SESSION request | ||
2679 | */ | ||
2680 | static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req, | ||
2681 | struct xdr_stream *xdr, | ||
2682 | struct nfs_client *clp) | ||
2683 | { | ||
2684 | struct compound_hdr hdr = { | ||
2685 | .minorversion = clp->cl_mvops->minor_version, | ||
2686 | }; | ||
2687 | |||
2688 | encode_compound_hdr(xdr, req, &hdr); | ||
2689 | encode_bind_conn_to_session(xdr, clp->cl_session, &hdr); | ||
2690 | encode_nops(&hdr); | ||
2691 | } | ||
2692 | |||
2693 | /* | ||
2654 | * EXCHANGE_ID request | 2694 | * EXCHANGE_ID request |
2655 | */ | 2695 | */ |
2656 | static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, | 2696 | static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, |
@@ -2699,6 +2739,22 @@ static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req, | |||
2699 | } | 2739 | } |
2700 | 2740 | ||
2701 | /* | 2741 | /* |
2742 | * a DESTROY_CLIENTID request | ||
2743 | */ | ||
2744 | static void nfs4_xdr_enc_destroy_clientid(struct rpc_rqst *req, | ||
2745 | struct xdr_stream *xdr, | ||
2746 | struct nfs_client *clp) | ||
2747 | { | ||
2748 | struct compound_hdr hdr = { | ||
2749 | .minorversion = clp->cl_mvops->minor_version, | ||
2750 | }; | ||
2751 | |||
2752 | encode_compound_hdr(xdr, req, &hdr); | ||
2753 | encode_destroy_clientid(xdr, clp->cl_clientid, &hdr); | ||
2754 | encode_nops(&hdr); | ||
2755 | } | ||
2756 | |||
2757 | /* | ||
2702 | * a SEQUENCE request | 2758 | * a SEQUENCE request |
2703 | */ | 2759 | */ |
2704 | static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr, | 2760 | static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr, |
@@ -4102,7 +4158,7 @@ static int decode_verifier(struct xdr_stream *xdr, void *verifier) | |||
4102 | return decode_opaque_fixed(xdr, verifier, NFS4_VERIFIER_SIZE); | 4158 | return decode_opaque_fixed(xdr, verifier, NFS4_VERIFIER_SIZE); |
4103 | } | 4159 | } |
4104 | 4160 | ||
4105 | static int decode_commit(struct xdr_stream *xdr, struct nfs_writeres *res) | 4161 | static int decode_commit(struct xdr_stream *xdr, struct nfs_commitres *res) |
4106 | { | 4162 | { |
4107 | int status; | 4163 | int status; |
4108 | 4164 | ||
@@ -4220,6 +4276,114 @@ xdr_error: | |||
4220 | return status; | 4276 | return status; |
4221 | } | 4277 | } |
4222 | 4278 | ||
4279 | static int decode_threshold_hint(struct xdr_stream *xdr, | ||
4280 | uint32_t *bitmap, | ||
4281 | uint64_t *res, | ||
4282 | uint32_t hint_bit) | ||
4283 | { | ||
4284 | __be32 *p; | ||
4285 | |||
4286 | *res = 0; | ||
4287 | if (likely(bitmap[0] & hint_bit)) { | ||
4288 | p = xdr_inline_decode(xdr, 8); | ||
4289 | if (unlikely(!p)) | ||
4290 | goto out_overflow; | ||
4291 | xdr_decode_hyper(p, res); | ||
4292 | } | ||
4293 | return 0; | ||
4294 | out_overflow: | ||
4295 | print_overflow_msg(__func__, xdr); | ||
4296 | return -EIO; | ||
4297 | } | ||
4298 | |||
4299 | static int decode_first_threshold_item4(struct xdr_stream *xdr, | ||
4300 | struct nfs4_threshold *res) | ||
4301 | { | ||
4302 | __be32 *p, *savep; | ||
4303 | uint32_t bitmap[3] = {0,}, attrlen; | ||
4304 | int status; | ||
4305 | |||
4306 | /* layout type */ | ||
4307 | p = xdr_inline_decode(xdr, 4); | ||
4308 | if (unlikely(!p)) { | ||
4309 | print_overflow_msg(__func__, xdr); | ||
4310 | return -EIO; | ||
4311 | } | ||
4312 | res->l_type = be32_to_cpup(p); | ||
4313 | |||
4314 | /* thi_hintset bitmap */ | ||
4315 | status = decode_attr_bitmap(xdr, bitmap); | ||
4316 | if (status < 0) | ||
4317 | goto xdr_error; | ||
4318 | |||
4319 | /* thi_hintlist length */ | ||
4320 | status = decode_attr_length(xdr, &attrlen, &savep); | ||
4321 | if (status < 0) | ||
4322 | goto xdr_error; | ||
4323 | /* thi_hintlist */ | ||
4324 | status = decode_threshold_hint(xdr, bitmap, &res->rd_sz, THRESHOLD_RD); | ||
4325 | if (status < 0) | ||
4326 | goto xdr_error; | ||
4327 | status = decode_threshold_hint(xdr, bitmap, &res->wr_sz, THRESHOLD_WR); | ||
4328 | if (status < 0) | ||
4329 | goto xdr_error; | ||
4330 | status = decode_threshold_hint(xdr, bitmap, &res->rd_io_sz, | ||
4331 | THRESHOLD_RD_IO); | ||
4332 | if (status < 0) | ||
4333 | goto xdr_error; | ||
4334 | status = decode_threshold_hint(xdr, bitmap, &res->wr_io_sz, | ||
4335 | THRESHOLD_WR_IO); | ||
4336 | if (status < 0) | ||
4337 | goto xdr_error; | ||
4338 | |||
4339 | status = verify_attr_len(xdr, savep, attrlen); | ||
4340 | res->bm = bitmap[0]; | ||
4341 | |||
4342 | dprintk("%s bm=0x%x rd_sz=%llu wr_sz=%llu rd_io=%llu wr_io=%llu\n", | ||
4343 | __func__, res->bm, res->rd_sz, res->wr_sz, res->rd_io_sz, | ||
4344 | res->wr_io_sz); | ||
4345 | xdr_error: | ||
4346 | dprintk("%s ret=%d!\n", __func__, status); | ||
4347 | return status; | ||
4348 | } | ||
4349 | |||
4350 | /* | ||
4351 | * Thresholds on pNFS direct I/O vrs MDS I/O | ||
4352 | */ | ||
4353 | static int decode_attr_mdsthreshold(struct xdr_stream *xdr, | ||
4354 | uint32_t *bitmap, | ||
4355 | struct nfs4_threshold *res) | ||
4356 | { | ||
4357 | __be32 *p; | ||
4358 | int status = 0; | ||
4359 | uint32_t num; | ||
4360 | |||
4361 | if (unlikely(bitmap[2] & (FATTR4_WORD2_MDSTHRESHOLD - 1U))) | ||
4362 | return -EIO; | ||
4363 | if (bitmap[2] & FATTR4_WORD2_MDSTHRESHOLD) { | ||
4364 | /* Did the server return an unrequested attribute? */ | ||
4365 | if (unlikely(res == NULL)) | ||
4366 | return -EREMOTEIO; | ||
4367 | p = xdr_inline_decode(xdr, 4); | ||
4368 | if (unlikely(!p)) | ||
4369 | goto out_overflow; | ||
4370 | num = be32_to_cpup(p); | ||
4371 | if (num == 0) | ||
4372 | return 0; | ||
4373 | if (num > 1) | ||
4374 | printk(KERN_INFO "%s: Warning: Multiple pNFS layout " | ||
4375 | "drivers per filesystem not supported\n", | ||
4376 | __func__); | ||
4377 | |||
4378 | status = decode_first_threshold_item4(xdr, res); | ||
4379 | bitmap[2] &= ~FATTR4_WORD2_MDSTHRESHOLD; | ||
4380 | } | ||
4381 | return status; | ||
4382 | out_overflow: | ||
4383 | print_overflow_msg(__func__, xdr); | ||
4384 | return -EIO; | ||
4385 | } | ||
4386 | |||
4223 | static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | 4387 | static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, |
4224 | struct nfs_fattr *fattr, struct nfs_fh *fh, | 4388 | struct nfs_fattr *fattr, struct nfs_fh *fh, |
4225 | struct nfs4_fs_locations *fs_loc, | 4389 | struct nfs4_fs_locations *fs_loc, |
@@ -4326,6 +4490,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4326 | goto xdr_error; | 4490 | goto xdr_error; |
4327 | fattr->valid |= status; | 4491 | fattr->valid |= status; |
4328 | 4492 | ||
4493 | status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold); | ||
4494 | if (status < 0) | ||
4495 | goto xdr_error; | ||
4496 | |||
4329 | xdr_error: | 4497 | xdr_error: |
4330 | dprintk("%s: xdr returned %d\n", __func__, -status); | 4498 | dprintk("%s: xdr returned %d\n", __func__, -status); |
4331 | return status; | 4499 | return status; |
@@ -5156,7 +5324,6 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
5156 | uint32_t dummy; | 5324 | uint32_t dummy; |
5157 | char *dummy_str; | 5325 | char *dummy_str; |
5158 | int status; | 5326 | int status; |
5159 | struct nfs_client *clp = res->client; | ||
5160 | uint32_t impl_id_count; | 5327 | uint32_t impl_id_count; |
5161 | 5328 | ||
5162 | status = decode_op_hdr(xdr, OP_EXCHANGE_ID); | 5329 | status = decode_op_hdr(xdr, OP_EXCHANGE_ID); |
@@ -5166,36 +5333,39 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
5166 | p = xdr_inline_decode(xdr, 8); | 5333 | p = xdr_inline_decode(xdr, 8); |
5167 | if (unlikely(!p)) | 5334 | if (unlikely(!p)) |
5168 | goto out_overflow; | 5335 | goto out_overflow; |
5169 | xdr_decode_hyper(p, &clp->cl_clientid); | 5336 | xdr_decode_hyper(p, &res->clientid); |
5170 | p = xdr_inline_decode(xdr, 12); | 5337 | p = xdr_inline_decode(xdr, 12); |
5171 | if (unlikely(!p)) | 5338 | if (unlikely(!p)) |
5172 | goto out_overflow; | 5339 | goto out_overflow; |
5173 | clp->cl_seqid = be32_to_cpup(p++); | 5340 | res->seqid = be32_to_cpup(p++); |
5174 | clp->cl_exchange_flags = be32_to_cpup(p++); | 5341 | res->flags = be32_to_cpup(p++); |
5175 | 5342 | ||
5176 | /* We ask for SP4_NONE */ | 5343 | /* We ask for SP4_NONE */ |
5177 | dummy = be32_to_cpup(p); | 5344 | dummy = be32_to_cpup(p); |
5178 | if (dummy != SP4_NONE) | 5345 | if (dummy != SP4_NONE) |
5179 | return -EIO; | 5346 | return -EIO; |
5180 | 5347 | ||
5181 | /* Throw away minor_id */ | 5348 | /* server_owner4.so_minor_id */ |
5182 | p = xdr_inline_decode(xdr, 8); | 5349 | p = xdr_inline_decode(xdr, 8); |
5183 | if (unlikely(!p)) | 5350 | if (unlikely(!p)) |
5184 | goto out_overflow; | 5351 | goto out_overflow; |
5352 | p = xdr_decode_hyper(p, &res->server_owner->minor_id); | ||
5185 | 5353 | ||
5186 | /* Throw away Major id */ | 5354 | /* server_owner4.so_major_id */ |
5187 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); | 5355 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); |
5188 | if (unlikely(status)) | 5356 | if (unlikely(status)) |
5189 | return status; | 5357 | return status; |
5358 | if (unlikely(dummy > NFS4_OPAQUE_LIMIT)) | ||
5359 | return -EIO; | ||
5360 | memcpy(res->server_owner->major_id, dummy_str, dummy); | ||
5361 | res->server_owner->major_id_sz = dummy; | ||
5190 | 5362 | ||
5191 | /* Save server_scope */ | 5363 | /* server_scope4 */ |
5192 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); | 5364 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); |
5193 | if (unlikely(status)) | 5365 | if (unlikely(status)) |
5194 | return status; | 5366 | return status; |
5195 | |||
5196 | if (unlikely(dummy > NFS4_OPAQUE_LIMIT)) | 5367 | if (unlikely(dummy > NFS4_OPAQUE_LIMIT)) |
5197 | return -EIO; | 5368 | return -EIO; |
5198 | |||
5199 | memcpy(res->server_scope->server_scope, dummy_str, dummy); | 5369 | memcpy(res->server_scope->server_scope, dummy_str, dummy); |
5200 | res->server_scope->server_scope_sz = dummy; | 5370 | res->server_scope->server_scope_sz = dummy; |
5201 | 5371 | ||
@@ -5276,6 +5446,37 @@ static int decode_sessionid(struct xdr_stream *xdr, struct nfs4_sessionid *sid) | |||
5276 | return decode_opaque_fixed(xdr, sid->data, NFS4_MAX_SESSIONID_LEN); | 5446 | return decode_opaque_fixed(xdr, sid->data, NFS4_MAX_SESSIONID_LEN); |
5277 | } | 5447 | } |
5278 | 5448 | ||
5449 | static int decode_bind_conn_to_session(struct xdr_stream *xdr, | ||
5450 | struct nfs41_bind_conn_to_session_res *res) | ||
5451 | { | ||
5452 | __be32 *p; | ||
5453 | int status; | ||
5454 | |||
5455 | status = decode_op_hdr(xdr, OP_BIND_CONN_TO_SESSION); | ||
5456 | if (!status) | ||
5457 | status = decode_sessionid(xdr, &res->session->sess_id); | ||
5458 | if (unlikely(status)) | ||
5459 | return status; | ||
5460 | |||
5461 | /* dir flags, rdma mode bool */ | ||
5462 | p = xdr_inline_decode(xdr, 8); | ||
5463 | if (unlikely(!p)) | ||
5464 | goto out_overflow; | ||
5465 | |||
5466 | res->dir = be32_to_cpup(p++); | ||
5467 | if (res->dir == 0 || res->dir > NFS4_CDFS4_BOTH) | ||
5468 | return -EIO; | ||
5469 | if (be32_to_cpup(p) == 0) | ||
5470 | res->use_conn_in_rdma_mode = false; | ||
5471 | else | ||
5472 | res->use_conn_in_rdma_mode = true; | ||
5473 | |||
5474 | return 0; | ||
5475 | out_overflow: | ||
5476 | print_overflow_msg(__func__, xdr); | ||
5477 | return -EIO; | ||
5478 | } | ||
5479 | |||
5279 | static int decode_create_session(struct xdr_stream *xdr, | 5480 | static int decode_create_session(struct xdr_stream *xdr, |
5280 | struct nfs41_create_session_res *res) | 5481 | struct nfs41_create_session_res *res) |
5281 | { | 5482 | { |
@@ -5312,6 +5513,11 @@ static int decode_destroy_session(struct xdr_stream *xdr, void *dummy) | |||
5312 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); | 5513 | return decode_op_hdr(xdr, OP_DESTROY_SESSION); |
5313 | } | 5514 | } |
5314 | 5515 | ||
5516 | static int decode_destroy_clientid(struct xdr_stream *xdr, void *dummy) | ||
5517 | { | ||
5518 | return decode_op_hdr(xdr, OP_DESTROY_CLIENTID); | ||
5519 | } | ||
5520 | |||
5315 | static int decode_reclaim_complete(struct xdr_stream *xdr, void *dummy) | 5521 | static int decode_reclaim_complete(struct xdr_stream *xdr, void *dummy) |
5316 | { | 5522 | { |
5317 | return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE); | 5523 | return decode_op_hdr(xdr, OP_RECLAIM_COMPLETE); |
@@ -5800,9 +6006,6 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
5800 | if (status) | 6006 | if (status) |
5801 | goto out; | 6007 | goto out; |
5802 | status = decode_remove(xdr, &res->cinfo); | 6008 | status = decode_remove(xdr, &res->cinfo); |
5803 | if (status) | ||
5804 | goto out; | ||
5805 | decode_getfattr(xdr, res->dir_attr, res->server); | ||
5806 | out: | 6009 | out: |
5807 | return status; | 6010 | return status; |
5808 | } | 6011 | } |
@@ -5832,15 +6035,6 @@ static int nfs4_xdr_dec_rename(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
5832 | if (status) | 6035 | if (status) |
5833 | goto out; | 6036 | goto out; |
5834 | status = decode_rename(xdr, &res->old_cinfo, &res->new_cinfo); | 6037 | status = decode_rename(xdr, &res->old_cinfo, &res->new_cinfo); |
5835 | if (status) | ||
5836 | goto out; | ||
5837 | /* Current FH is target directory */ | ||
5838 | if (decode_getfattr(xdr, res->new_fattr, res->server)) | ||
5839 | goto out; | ||
5840 | status = decode_restorefh(xdr); | ||
5841 | if (status) | ||
5842 | goto out; | ||
5843 | decode_getfattr(xdr, res->old_fattr, res->server); | ||
5844 | out: | 6038 | out: |
5845 | return status; | 6039 | return status; |
5846 | } | 6040 | } |
@@ -5876,8 +6070,6 @@ static int nfs4_xdr_dec_link(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
5876 | * Note order: OP_LINK leaves the directory as the current | 6070 | * Note order: OP_LINK leaves the directory as the current |
5877 | * filehandle. | 6071 | * filehandle. |
5878 | */ | 6072 | */ |
5879 | if (decode_getfattr(xdr, res->dir_attr, res->server)) | ||
5880 | goto out; | ||
5881 | status = decode_restorefh(xdr); | 6073 | status = decode_restorefh(xdr); |
5882 | if (status) | 6074 | if (status) |
5883 | goto out; | 6075 | goto out; |
@@ -5904,21 +6096,13 @@ static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
5904 | status = decode_putfh(xdr); | 6096 | status = decode_putfh(xdr); |
5905 | if (status) | 6097 | if (status) |
5906 | goto out; | 6098 | goto out; |
5907 | status = decode_savefh(xdr); | ||
5908 | if (status) | ||
5909 | goto out; | ||
5910 | status = decode_create(xdr, &res->dir_cinfo); | 6099 | status = decode_create(xdr, &res->dir_cinfo); |
5911 | if (status) | 6100 | if (status) |
5912 | goto out; | 6101 | goto out; |
5913 | status = decode_getfh(xdr, res->fh); | 6102 | status = decode_getfh(xdr, res->fh); |
5914 | if (status) | 6103 | if (status) |
5915 | goto out; | 6104 | goto out; |
5916 | if (decode_getfattr(xdr, res->fattr, res->server)) | 6105 | decode_getfattr(xdr, res->fattr, res->server); |
5917 | goto out; | ||
5918 | status = decode_restorefh(xdr); | ||
5919 | if (status) | ||
5920 | goto out; | ||
5921 | decode_getfattr(xdr, res->dir_fattr, res->server); | ||
5922 | out: | 6106 | out: |
5923 | return status; | 6107 | return status; |
5924 | } | 6108 | } |
@@ -6075,19 +6259,12 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
6075 | status = decode_putfh(xdr); | 6259 | status = decode_putfh(xdr); |
6076 | if (status) | 6260 | if (status) |
6077 | goto out; | 6261 | goto out; |
6078 | status = decode_savefh(xdr); | ||
6079 | if (status) | ||
6080 | goto out; | ||
6081 | status = decode_open(xdr, res); | 6262 | status = decode_open(xdr, res); |
6082 | if (status) | 6263 | if (status) |
6083 | goto out; | 6264 | goto out; |
6084 | if (decode_getfh(xdr, &res->fh) != 0) | 6265 | if (decode_getfh(xdr, &res->fh) != 0) |
6085 | goto out; | 6266 | goto out; |
6086 | if (decode_getfattr(xdr, res->f_attr, res->server) != 0) | 6267 | decode_getfattr(xdr, res->f_attr, res->server); |
6087 | goto out; | ||
6088 | if (decode_restorefh(xdr) != 0) | ||
6089 | goto out; | ||
6090 | decode_getfattr(xdr, res->dir_attr, res->server); | ||
6091 | out: | 6268 | out: |
6092 | return status; | 6269 | return status; |
6093 | } | 6270 | } |
@@ -6353,7 +6530,7 @@ out: | |||
6353 | * Decode COMMIT response | 6530 | * Decode COMMIT response |
6354 | */ | 6531 | */ |
6355 | static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | 6532 | static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr, |
6356 | struct nfs_writeres *res) | 6533 | struct nfs_commitres *res) |
6357 | { | 6534 | { |
6358 | struct compound_hdr hdr; | 6535 | struct compound_hdr hdr; |
6359 | int status; | 6536 | int status; |
@@ -6368,10 +6545,6 @@ static int nfs4_xdr_dec_commit(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
6368 | if (status) | 6545 | if (status) |
6369 | goto out; | 6546 | goto out; |
6370 | status = decode_commit(xdr, res); | 6547 | status = decode_commit(xdr, res); |
6371 | if (status) | ||
6372 | goto out; | ||
6373 | if (res->fattr) | ||
6374 | decode_getfattr(xdr, res->fattr, res->server); | ||
6375 | out: | 6548 | out: |
6376 | return status; | 6549 | return status; |
6377 | } | 6550 | } |
@@ -6527,10 +6700,10 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, | |||
6527 | status = decode_putfh(xdr); | 6700 | status = decode_putfh(xdr); |
6528 | if (status != 0) | 6701 | if (status != 0) |
6529 | goto out; | 6702 | goto out; |
6530 | status = decode_delegreturn(xdr); | 6703 | status = decode_getfattr(xdr, res->fattr, res->server); |
6531 | if (status != 0) | 6704 | if (status != 0) |
6532 | goto out; | 6705 | goto out; |
6533 | decode_getfattr(xdr, res->fattr, res->server); | 6706 | status = decode_delegreturn(xdr); |
6534 | out: | 6707 | out: |
6535 | return status; | 6708 | return status; |
6536 | } | 6709 | } |
@@ -6591,6 +6764,22 @@ out: | |||
6591 | 6764 | ||
6592 | #if defined(CONFIG_NFS_V4_1) | 6765 | #if defined(CONFIG_NFS_V4_1) |
6593 | /* | 6766 | /* |
6767 | * Decode BIND_CONN_TO_SESSION response | ||
6768 | */ | ||
6769 | static int nfs4_xdr_dec_bind_conn_to_session(struct rpc_rqst *rqstp, | ||
6770 | struct xdr_stream *xdr, | ||
6771 | void *res) | ||
6772 | { | ||
6773 | struct compound_hdr hdr; | ||
6774 | int status; | ||
6775 | |||
6776 | status = decode_compound_hdr(xdr, &hdr); | ||
6777 | if (!status) | ||
6778 | status = decode_bind_conn_to_session(xdr, res); | ||
6779 | return status; | ||
6780 | } | ||
6781 | |||
6782 | /* | ||
6594 | * Decode EXCHANGE_ID response | 6783 | * Decode EXCHANGE_ID response |
6595 | */ | 6784 | */ |
6596 | static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, | 6785 | static int nfs4_xdr_dec_exchange_id(struct rpc_rqst *rqstp, |
@@ -6639,6 +6828,22 @@ static int nfs4_xdr_dec_destroy_session(struct rpc_rqst *rqstp, | |||
6639 | } | 6828 | } |
6640 | 6829 | ||
6641 | /* | 6830 | /* |
6831 | * Decode DESTROY_CLIENTID response | ||
6832 | */ | ||
6833 | static int nfs4_xdr_dec_destroy_clientid(struct rpc_rqst *rqstp, | ||
6834 | struct xdr_stream *xdr, | ||
6835 | void *res) | ||
6836 | { | ||
6837 | struct compound_hdr hdr; | ||
6838 | int status; | ||
6839 | |||
6840 | status = decode_compound_hdr(xdr, &hdr); | ||
6841 | if (!status) | ||
6842 | status = decode_destroy_clientid(xdr, res); | ||
6843 | return status; | ||
6844 | } | ||
6845 | |||
6846 | /* | ||
6642 | * Decode SEQUENCE response | 6847 | * Decode SEQUENCE response |
6643 | */ | 6848 | */ |
6644 | static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, | 6849 | static int nfs4_xdr_dec_sequence(struct rpc_rqst *rqstp, |
@@ -7085,6 +7290,9 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
7085 | PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), | 7290 | PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), |
7086 | PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid), | 7291 | PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid), |
7087 | PROC(GETDEVICELIST, enc_getdevicelist, dec_getdevicelist), | 7292 | PROC(GETDEVICELIST, enc_getdevicelist, dec_getdevicelist), |
7293 | PROC(BIND_CONN_TO_SESSION, | ||
7294 | enc_bind_conn_to_session, dec_bind_conn_to_session), | ||
7295 | PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid), | ||
7088 | #endif /* CONFIG_NFS_V4_1 */ | 7296 | #endif /* CONFIG_NFS_V4_1 */ |
7089 | }; | 7297 | }; |
7090 | 7298 | ||