| @@ -326,6 +326,16 @@ static int nfs4_stat_to_errno(int); · 325 unmodified lines |
| 326 | 326 | 1 /* csr_flags */ + \ |
| 327 | 327 | decode_channel_attrs_maxsz + \ |
| 328 | 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 */) |
| 329 | 339 | #define encode_destroy_session_maxsz (op_encode_hdr_maxsz + 4) |
| 330 | 340 | #define decode_destroy_session_maxsz (op_decode_hdr_maxsz) |
| 331 | 341 | #define encode_sequence_maxsz (op_encode_hdr_maxsz + \ |
| @@ -719,6 +729,12 @@ static int nfs4_stat_to_errno(int); · 387 unmodified lines |
| 719 | 729 | decode_putfh_maxsz + \ |
| 720 | 730 | decode_secinfo_maxsz) |
| 721 | 731 | #if defined(CONFIG_NFS_V4_1) |
| 732 | +#define NFS4_enc_bind_conn_to_session_sz \ |
| 733 | + (compound_encode_hdr_maxsz + \ |
| 734 | + encode_bind_conn_to_session_maxsz) |
| 735 | +#define NFS4_dec_bind_conn_to_session_sz \ |
| 736 | + (compound_decode_hdr_maxsz + \ |
| 737 | + decode_bind_conn_to_session_maxsz) |
| 722 | 738 | #define NFS4_enc_exchange_id_sz \ |
| 723 | 739 | (compound_encode_hdr_maxsz + \ |
| 724 | 740 | encode_exchange_id_maxsz) |
| @@ -1669,6 +1685,20 @@ static void encode_secinfo(struct xdr_stream *xdr, const struct qstr *name, stru · 944 unmodified lines |
| 1669 | 1685 | |
| 1670 | 1686 | #if defined(CONFIG_NFS_V4_1) |
| 1671 | 1687 | /* NFSv4.1 operations */ |
| 1688 | +static void encode_bind_conn_to_session(struct xdr_stream *xdr, |
| 1689 | + struct nfs4_session *session, |
| 1690 | + struct compound_hdr *hdr) |
| 1691 | +{ |
| 1692 | + __be32 *p; |
| 1693 | + |
| 1694 | + encode_op_hdr(xdr, OP_BIND_CONN_TO_SESSION, |
| 1695 | + decode_bind_conn_to_session_maxsz, hdr); |
| 1696 | + encode_opaque_fixed(xdr, session->sess_id.data, NFS4_MAX_SESSIONID_LEN); |
| 1697 | + p = xdr_reserve_space(xdr, 8); |
| 1698 | + *p++ = cpu_to_be32(NFS4_CDFC4_BACK_OR_BOTH); |
| 1699 | + *p = 0; /* use_conn_in_rdma_mode = False */ |
| 1700 | +} |
| 1701 | + |
| 1672 | 1702 | static void encode_exchange_id(struct xdr_stream *xdr, |
| 1673 | 1703 | struct nfs41_exchange_id_args *args, |
| 1674 | 1704 | struct compound_hdr *hdr) |
| @@ -2629,6 +2659,22 @@ static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req, · 954 unmodified lines |
| 2629 | 2659 | } |
| 2630 | 2660 | |
| 2631 | 2661 | #if defined(CONFIG_NFS_V4_1) |
| 2662 | +/* |
| 2663 | + * BIND_CONN_TO_SESSION request |
| 2664 | + */ |
| 2665 | +static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req, |
| 2666 | + struct xdr_stream *xdr, |
| 2667 | + struct nfs_client *clp) |
| 2668 | +{ |
| 2669 | + struct compound_hdr hdr = { |
| 2670 | + .minorversion = clp->cl_mvops->minor_version, |
| 2671 | + }; |
| 2672 | + |
| 2673 | + encode_compound_hdr(xdr, req, &hdr); |
| 2674 | + encode_bind_conn_to_session(xdr, clp->cl_session, &hdr); |
| 2675 | + encode_nops(&hdr); |
| 2676 | +} |
| 2677 | + |
| 2632 | 2678 | /* |
| 2633 | 2679 | * EXCHANGE_ID request |
| 2634 | 2680 | */ |
| @@ -5366,6 +5412,37 @@ static int decode_sessionid(struct xdr_stream *xdr, struct nfs4_sessionid *sid) · 2731 unmodified lines |
| 5366 | 5412 | return decode_opaque_fixed(xdr, sid->data, NFS4_MAX_SESSIONID_LEN); |
| 5367 | 5413 | } |
| 5368 | 5414 | |
| 5415 | +static int decode_bind_conn_to_session(struct xdr_stream *xdr, |
| 5416 | + struct nfs41_bind_conn_to_session_res *res) |
| 5417 | +{ |
| 5418 | + __be32 *p; |
| 5419 | + int status; |
| 5420 | + |
| 5421 | + status = decode_op_hdr(xdr, OP_BIND_CONN_TO_SESSION); |
| 5422 | + if (!status) |
| 5423 | + status = decode_sessionid(xdr, &res->session->sess_id); |
| 5424 | + if (unlikely(status)) |
| 5425 | + return status; |
| 5426 | + |
| 5427 | + /* dir flags, rdma mode bool */ |
| 5428 | + p = xdr_inline_decode(xdr, 8); |
| 5429 | + if (unlikely(!p)) |
| 5430 | + goto out_overflow; |
| 5431 | + |
| 5432 | + res->dir = be32_to_cpup(p++); |
| 5433 | + if (res->dir == 0 || res->dir > NFS4_CDFS4_BOTH) |
| 5434 | + return -EIO; |
| 5435 | + if (be32_to_cpup(p) == 0) |
| 5436 | + res->use_conn_in_rdma_mode = false; |
| 5437 | + else |
| 5438 | + res->use_conn_in_rdma_mode = true; |
| 5439 | + |
| 5440 | + return 0; |
| 5441 | +out_overflow: |
| 5442 | + print_overflow_msg(__func__, xdr); |
| 5443 | + return -EIO; |
| 5444 | +} |
| 5445 | + |
| 5369 | 5446 | static int decode_create_session(struct xdr_stream *xdr, |
| 5370 | 5447 | struct nfs41_create_session_res *res) |
| 5371 | 5448 | { |
| @@ -6647,6 +6724,22 @@ out: · 1275 unmodified lines |
| 6647 | 6724 | } |
| 6648 | 6725 | |
| 6649 | 6726 | #if defined(CONFIG_NFS_V4_1) |
| 6727 | +/* |
| 6728 | + * Decode BIND_CONN_TO_SESSION response |
| 6729 | + */ |
| 6730 | +static int nfs4_xdr_dec_bind_conn_to_session(struct rpc_rqst *rqstp, |
| 6731 | + struct xdr_stream *xdr, |
| 6732 | + void *res) |
| 6733 | +{ |
| 6734 | + struct compound_hdr hdr; |
| 6735 | + int status; |
| 6736 | + |
| 6737 | + status = decode_compound_hdr(xdr, &hdr); |
| 6738 | + if (!status) |
| 6739 | + status = decode_bind_conn_to_session(xdr, res); |
| 6740 | + return status; |
| 6741 | +} |
| 6742 | + |
| 6650 | 6743 | /* |
| 6651 | 6744 | * Decode EXCHANGE_ID response |
| 6652 | 6745 | */ |
| @@ -7128,6 +7221,8 @@ struct rpc_procinfo nfs4_procedures[] = { · 475 unmodified lines |
| 7128 | 7221 | PROC(RELEASE_LOCKOWNER, enc_release_lockowner, dec_release_lockowner), |
| 7129 | 7222 | PROC(SECINFO, enc_secinfo, dec_secinfo), |
| 7130 | 7223 | #if defined(CONFIG_NFS_V4_1) |
| 7224 | + PROC(BIND_CONN_TO_SESSION, |
| 7225 | + enc_bind_conn_to_session, dec_bind_conn_to_session), |
| 7131 | 7226 | PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id), |
| 7132 | 7227 | PROC(CREATE_SESSION, enc_create_session, dec_create_session), |
| 7133 | 7228 | PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), |