aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2018-06-11 18:00:59 -0400
committerSteve French <stfrench@microsoft.com>2018-06-15 03:38:08 -0400
commit40eff45b5dc7df73fc8926c9bd81bde2d4c8ccca (patch)
tree4711b3dc874dd1ae0a9e4ce40e1c5c655c5889dd
parentc713c8770fa5bfbeaac088cc7b959c7a6ba79f93 (diff)
cifs: remove smb2_send_recv()
Now that we have the plumbing to pass request without an rfc1002 header all the way down to the point we write to the socket we no longer need the smb2_send_recv() function. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/smb2pdu.c137
-rw-r--r--fs/cifs/transport.c17
3 files changed, 116 insertions, 42 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 4f9218281ff3..03018be17283 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -112,10 +112,6 @@ extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
112 struct kvec *, int /* nvec to send */, 112 struct kvec *, int /* nvec to send */,
113 int * /* type of buf returned */, const int flags, 113 int * /* type of buf returned */, const int flags,
114 struct kvec * /* resp vec */); 114 struct kvec * /* resp vec */);
115extern int smb2_send_recv(const unsigned int xid, struct cifs_ses *pses,
116 struct kvec *pkvec, int nvec_to_send,
117 int *pbuftype, const int flags,
118 struct kvec *presp);
119extern int SendReceiveBlockingLock(const unsigned int xid, 115extern int SendReceiveBlockingLock(const unsigned int xid,
120 struct cifs_tcon *ptcon, 116 struct cifs_tcon *ptcon,
121 struct smb_hdr *in_buf , 117 struct smb_hdr *in_buf ,
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index c48608c5a0fb..7daf38ab814a 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -602,6 +602,7 @@ static void assemble_neg_contexts(struct smb2_negotiate_req *req,
602int 602int
603SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) 603SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
604{ 604{
605 struct smb_rqst rqst;
605 struct smb2_negotiate_req *req; 606 struct smb2_negotiate_req *req;
606 struct smb2_negotiate_rsp *rsp; 607 struct smb2_negotiate_rsp *rsp;
607 struct kvec iov[1]; 608 struct kvec iov[1];
@@ -673,7 +674,11 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
673 iov[0].iov_base = (char *)req; 674 iov[0].iov_base = (char *)req;
674 iov[0].iov_len = total_len; 675 iov[0].iov_len = total_len;
675 676
676 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buftype, flags, &rsp_iov); 677 memset(&rqst, 0, sizeof(struct smb_rqst));
678 rqst.rq_iov = iov;
679 rqst.rq_nvec = 1;
680
681 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
677 cifs_small_buf_release(req); 682 cifs_small_buf_release(req);
678 rsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base; 683 rsp = (struct smb2_negotiate_rsp *)rsp_iov.iov_base;
679 /* 684 /*
@@ -1028,6 +1033,7 @@ static int
1028SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data) 1033SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
1029{ 1034{
1030 int rc; 1035 int rc;
1036 struct smb_rqst rqst;
1031 struct smb2_sess_setup_req *req = sess_data->iov[0].iov_base; 1037 struct smb2_sess_setup_req *req = sess_data->iov[0].iov_base;
1032 struct kvec rsp_iov = { NULL, 0 }; 1038 struct kvec rsp_iov = { NULL, 0 };
1033 1039
@@ -1036,10 +1042,13 @@ SMB2_sess_sendreceive(struct SMB2_sess_data *sess_data)
1036 cpu_to_le16(sizeof(struct smb2_sess_setup_req) - 1 /* pad */); 1042 cpu_to_le16(sizeof(struct smb2_sess_setup_req) - 1 /* pad */);
1037 req->SecurityBufferLength = cpu_to_le16(sess_data->iov[1].iov_len); 1043 req->SecurityBufferLength = cpu_to_le16(sess_data->iov[1].iov_len);
1038 1044
1039 /* BB add code to build os and lm fields */ 1045 memset(&rqst, 0, sizeof(struct smb_rqst));
1046 rqst.rq_iov = sess_data->iov;
1047 rqst.rq_nvec = 2;
1040 1048
1041 rc = smb2_send_recv(sess_data->xid, sess_data->ses, 1049 /* BB add code to build os and lm fields */
1042 sess_data->iov, 2, 1050 rc = cifs_send_recv(sess_data->xid, sess_data->ses,
1051 &rqst,
1043 &sess_data->buf0_type, 1052 &sess_data->buf0_type,
1044 CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov); 1053 CIFS_LOG_ERROR | CIFS_NEG_OP, &rsp_iov);
1045 cifs_small_buf_release(sess_data->iov[0].iov_base); 1054 cifs_small_buf_release(sess_data->iov[0].iov_base);
@@ -1377,6 +1386,7 @@ out:
1377int 1386int
1378SMB2_logoff(const unsigned int xid, struct cifs_ses *ses) 1387SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
1379{ 1388{
1389 struct smb_rqst rqst;
1380 struct smb2_logoff_req *req; /* response is also trivial struct */ 1390 struct smb2_logoff_req *req; /* response is also trivial struct */
1381 int rc = 0; 1391 int rc = 0;
1382 struct TCP_Server_Info *server; 1392 struct TCP_Server_Info *server;
@@ -1414,7 +1424,11 @@ SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
1414 iov[0].iov_base = (char *)req; 1424 iov[0].iov_base = (char *)req;
1415 iov[0].iov_len = total_len; 1425 iov[0].iov_len = total_len;
1416 1426
1417 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buf_type, flags, &rsp_iov); 1427 memset(&rqst, 0, sizeof(struct smb_rqst));
1428 rqst.rq_iov = iov;
1429 rqst.rq_nvec = 1;
1430
1431 rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov);
1418 cifs_small_buf_release(req); 1432 cifs_small_buf_release(req);
1419 /* 1433 /*
1420 * No tcon so can't do 1434 * No tcon so can't do
@@ -1444,6 +1458,7 @@ int
1444SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, 1458SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
1445 struct cifs_tcon *tcon, const struct nls_table *cp) 1459 struct cifs_tcon *tcon, const struct nls_table *cp)
1446{ 1460{
1461 struct smb_rqst rqst;
1447 struct smb2_tree_connect_req *req; 1462 struct smb2_tree_connect_req *req;
1448 struct smb2_tree_connect_rsp *rsp = NULL; 1463 struct smb2_tree_connect_rsp *rsp = NULL;
1449 struct kvec iov[2]; 1464 struct kvec iov[2];
@@ -1500,7 +1515,11 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
1500 !smb3_encryption_required(tcon)) 1515 !smb3_encryption_required(tcon))
1501 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED; 1516 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
1502 1517
1503 rc = smb2_send_recv(xid, ses, iov, 2, &resp_buftype, flags, &rsp_iov); 1518 memset(&rqst, 0, sizeof(struct smb_rqst));
1519 rqst.rq_iov = iov;
1520 rqst.rq_nvec = 2;
1521
1522 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
1504 cifs_small_buf_release(req); 1523 cifs_small_buf_release(req);
1505 rsp = (struct smb2_tree_connect_rsp *)rsp_iov.iov_base; 1524 rsp = (struct smb2_tree_connect_rsp *)rsp_iov.iov_base;
1506 1525
@@ -1564,6 +1583,7 @@ tcon_error_exit:
1564int 1583int
1565SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon) 1584SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
1566{ 1585{
1586 struct smb_rqst rqst;
1567 struct smb2_tree_disconnect_req *req; /* response is trivial */ 1587 struct smb2_tree_disconnect_req *req; /* response is trivial */
1568 int rc = 0; 1588 int rc = 0;
1569 struct cifs_ses *ses = tcon->ses; 1589 struct cifs_ses *ses = tcon->ses;
@@ -1594,7 +1614,11 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
1594 iov[0].iov_base = (char *)req; 1614 iov[0].iov_base = (char *)req;
1595 iov[0].iov_len = total_len; 1615 iov[0].iov_len = total_len;
1596 1616
1597 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buf_type, flags, &rsp_iov); 1617 memset(&rqst, 0, sizeof(struct smb_rqst));
1618 rqst.rq_iov = iov;
1619 rqst.rq_nvec = 1;
1620
1621 rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov);
1598 cifs_small_buf_release(req); 1622 cifs_small_buf_release(req);
1599 if (rc) 1623 if (rc)
1600 cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE); 1624 cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE);
@@ -1892,6 +1916,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
1892 __u8 *oplock, struct smb2_file_all_info *buf, 1916 __u8 *oplock, struct smb2_file_all_info *buf,
1893 struct kvec *err_iov, int *buftype) 1917 struct kvec *err_iov, int *buftype)
1894{ 1918{
1919 struct smb_rqst rqst;
1895 struct smb2_create_req *req; 1920 struct smb2_create_req *req;
1896 struct smb2_create_rsp *rsp; 1921 struct smb2_create_rsp *rsp;
1897 struct TCP_Server_Info *server; 1922 struct TCP_Server_Info *server;
@@ -2044,7 +2069,11 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
2044 } 2069 }
2045#endif /* SMB311 */ 2070#endif /* SMB311 */
2046 2071
2047 rc = smb2_send_recv(xid, ses, iov, n_iov, &resp_buftype, flags, 2072 memset(&rqst, 0, sizeof(struct smb_rqst));
2073 rqst.rq_iov = iov;
2074 rqst.rq_nvec = n_iov;
2075
2076 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags,
2048 &rsp_iov); 2077 &rsp_iov);
2049 cifs_small_buf_release(req); 2078 cifs_small_buf_release(req);
2050 rsp = (struct smb2_create_rsp *)rsp_iov.iov_base; 2079 rsp = (struct smb2_create_rsp *)rsp_iov.iov_base;
@@ -2100,6 +2129,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
2100 char *in_data, u32 indatalen, 2129 char *in_data, u32 indatalen,
2101 char **out_data, u32 *plen /* returned data len */) 2130 char **out_data, u32 *plen /* returned data len */)
2102{ 2131{
2132 struct smb_rqst rqst;
2103 struct smb2_ioctl_req *req; 2133 struct smb2_ioctl_req *req;
2104 struct smb2_ioctl_rsp *rsp; 2134 struct smb2_ioctl_rsp *rsp;
2105 struct cifs_ses *ses; 2135 struct cifs_ses *ses;
@@ -2190,7 +2220,11 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
2190 if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) 2220 if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO)
2191 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED; 2221 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
2192 2222
2193 rc = smb2_send_recv(xid, ses, iov, n_iov, &resp_buftype, flags, 2223 memset(&rqst, 0, sizeof(struct smb_rqst));
2224 rqst.rq_iov = iov;
2225 rqst.rq_nvec = n_iov;
2226
2227 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags,
2194 &rsp_iov); 2228 &rsp_iov);
2195 cifs_small_buf_release(req); 2229 cifs_small_buf_release(req);
2196 rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base; 2230 rsp = (struct smb2_ioctl_rsp *)rsp_iov.iov_base;
@@ -2275,6 +2309,7 @@ int
2275SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, 2309SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon,
2276 u64 persistent_fid, u64 volatile_fid, int flags) 2310 u64 persistent_fid, u64 volatile_fid, int flags)
2277{ 2311{
2312 struct smb_rqst rqst;
2278 struct smb2_close_req *req; 2313 struct smb2_close_req *req;
2279 struct smb2_close_rsp *rsp; 2314 struct smb2_close_rsp *rsp;
2280 struct cifs_ses *ses = tcon->ses; 2315 struct cifs_ses *ses = tcon->ses;
@@ -2302,7 +2337,11 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon,
2302 iov[0].iov_base = (char *)req; 2337 iov[0].iov_base = (char *)req;
2303 iov[0].iov_len = total_len; 2338 iov[0].iov_len = total_len;
2304 2339
2305 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buftype, flags, &rsp_iov); 2340 memset(&rqst, 0, sizeof(struct smb_rqst));
2341 rqst.rq_iov = iov;
2342 rqst.rq_nvec = 1;
2343
2344 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
2306 cifs_small_buf_release(req); 2345 cifs_small_buf_release(req);
2307 rsp = (struct smb2_close_rsp *)rsp_iov.iov_base; 2346 rsp = (struct smb2_close_rsp *)rsp_iov.iov_base;
2308 2347
@@ -2388,6 +2427,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
2388 u32 additional_info, size_t output_len, size_t min_len, void **data, 2427 u32 additional_info, size_t output_len, size_t min_len, void **data,
2389 u32 *dlen) 2428 u32 *dlen)
2390{ 2429{
2430 struct smb_rqst rqst;
2391 struct smb2_query_info_req *req; 2431 struct smb2_query_info_req *req;
2392 struct smb2_query_info_rsp *rsp = NULL; 2432 struct smb2_query_info_rsp *rsp = NULL;
2393 struct kvec iov[2]; 2433 struct kvec iov[2];
@@ -2428,7 +2468,11 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
2428 /* 1 for Buffer */ 2468 /* 1 for Buffer */
2429 iov[0].iov_len = total_len - 1; 2469 iov[0].iov_len = total_len - 1;
2430 2470
2431 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buftype, flags, &rsp_iov); 2471 memset(&rqst, 0, sizeof(struct smb_rqst));
2472 rqst.rq_iov = iov;
2473 rqst.rq_nvec = 1;
2474
2475 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
2432 cifs_small_buf_release(req); 2476 cifs_small_buf_release(req);
2433 rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base; 2477 rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base;
2434 2478
@@ -2630,6 +2674,7 @@ int
2630SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, 2674SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
2631 u64 volatile_fid) 2675 u64 volatile_fid)
2632{ 2676{
2677 struct smb_rqst rqst;
2633 struct smb2_flush_req *req; 2678 struct smb2_flush_req *req;
2634 struct cifs_ses *ses = tcon->ses; 2679 struct cifs_ses *ses = tcon->ses;
2635 struct kvec iov[1]; 2680 struct kvec iov[1];
@@ -2657,7 +2702,11 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
2657 iov[0].iov_base = (char *)req; 2702 iov[0].iov_base = (char *)req;
2658 iov[0].iov_len = total_len; 2703 iov[0].iov_len = total_len;
2659 2704
2660 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buftype, flags, &rsp_iov); 2705 memset(&rqst, 0, sizeof(struct smb_rqst));
2706 rqst.rq_iov = iov;
2707 rqst.rq_nvec = 1;
2708
2709 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
2661 cifs_small_buf_release(req); 2710 cifs_small_buf_release(req);
2662 2711
2663 if (rc != 0) { 2712 if (rc != 0) {
@@ -2918,6 +2967,7 @@ int
2918SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, 2967SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
2919 unsigned int *nbytes, char **buf, int *buf_type) 2968 unsigned int *nbytes, char **buf, int *buf_type)
2920{ 2969{
2970 struct smb_rqst rqst;
2921 int resp_buftype, rc = -EACCES; 2971 int resp_buftype, rc = -EACCES;
2922 struct smb2_read_plain_req *req = NULL; 2972 struct smb2_read_plain_req *req = NULL;
2923 struct smb2_read_rsp *rsp = NULL; 2973 struct smb2_read_rsp *rsp = NULL;
@@ -2938,7 +2988,11 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
2938 iov[0].iov_base = (char *)req; 2988 iov[0].iov_base = (char *)req;
2939 iov[0].iov_len = total_len; 2989 iov[0].iov_len = total_len;
2940 2990
2941 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buftype, flags, &rsp_iov); 2991 memset(&rqst, 0, sizeof(struct smb_rqst));
2992 rqst.rq_iov = iov;
2993 rqst.rq_nvec = 1;
2994
2995 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
2942 cifs_small_buf_release(req); 2996 cifs_small_buf_release(req);
2943 2997
2944 rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; 2998 rsp = (struct smb2_read_rsp *)rsp_iov.iov_base;
@@ -3197,6 +3251,7 @@ int
3197SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, 3251SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
3198 unsigned int *nbytes, struct kvec *iov, int n_vec) 3252 unsigned int *nbytes, struct kvec *iov, int n_vec)
3199{ 3253{
3254 struct smb_rqst rqst;
3200 int rc = 0; 3255 int rc = 0;
3201 struct smb2_write_req *req = NULL; 3256 struct smb2_write_req *req = NULL;
3202 struct smb2_write_rsp *rsp = NULL; 3257 struct smb2_write_rsp *rsp = NULL;
@@ -3238,7 +3293,11 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
3238 /* 1 for Buffer */ 3293 /* 1 for Buffer */
3239 iov[0].iov_len = total_len - 1; 3294 iov[0].iov_len = total_len - 1;
3240 3295
3241 rc = smb2_send_recv(xid, io_parms->tcon->ses, iov, n_vec + 1, 3296 memset(&rqst, 0, sizeof(struct smb_rqst));
3297 rqst.rq_iov = iov;
3298 rqst.rq_nvec = n_vec + 1;
3299
3300 rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,
3242 &resp_buftype, flags, &rsp_iov); 3301 &resp_buftype, flags, &rsp_iov);
3243 cifs_small_buf_release(req); 3302 cifs_small_buf_release(req);
3244 rsp = (struct smb2_write_rsp *)rsp_iov.iov_base; 3303 rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;
@@ -3310,6 +3369,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
3310 u64 persistent_fid, u64 volatile_fid, int index, 3369 u64 persistent_fid, u64 volatile_fid, int index,
3311 struct cifs_search_info *srch_inf) 3370 struct cifs_search_info *srch_inf)
3312{ 3371{
3372 struct smb_rqst rqst;
3313 struct smb2_query_directory_req *req; 3373 struct smb2_query_directory_req *req;
3314 struct smb2_query_directory_rsp *rsp = NULL; 3374 struct smb2_query_directory_rsp *rsp = NULL;
3315 struct kvec iov[2]; 3375 struct kvec iov[2];
@@ -3382,7 +3442,11 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
3382 iov[1].iov_base = (char *)(req->Buffer); 3442 iov[1].iov_base = (char *)(req->Buffer);
3383 iov[1].iov_len = len; 3443 iov[1].iov_len = len;
3384 3444
3385 rc = smb2_send_recv(xid, ses, iov, 2, &resp_buftype, flags, &rsp_iov); 3445 memset(&rqst, 0, sizeof(struct smb_rqst));
3446 rqst.rq_iov = iov;
3447 rqst.rq_nvec = 2;
3448
3449 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
3386 cifs_small_buf_release(req); 3450 cifs_small_buf_release(req);
3387 rsp = (struct smb2_query_directory_rsp *)rsp_iov.iov_base; 3451 rsp = (struct smb2_query_directory_rsp *)rsp_iov.iov_base;
3388 3452
@@ -3441,6 +3505,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
3441 u8 info_type, u32 additional_info, unsigned int num, 3505 u8 info_type, u32 additional_info, unsigned int num,
3442 void **data, unsigned int *size) 3506 void **data, unsigned int *size)
3443{ 3507{
3508 struct smb_rqst rqst;
3444 struct smb2_set_info_req *req; 3509 struct smb2_set_info_req *req;
3445 struct smb2_set_info_rsp *rsp = NULL; 3510 struct smb2_set_info_rsp *rsp = NULL;
3446 struct kvec *iov; 3511 struct kvec *iov;
@@ -3496,7 +3561,11 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
3496 iov[i].iov_len = size[i]; 3561 iov[i].iov_len = size[i];
3497 } 3562 }
3498 3563
3499 rc = smb2_send_recv(xid, ses, iov, num, &resp_buftype, flags, 3564 memset(&rqst, 0, sizeof(struct smb_rqst));
3565 rqst.rq_iov = iov;
3566 rqst.rq_nvec = num;
3567
3568 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags,
3500 &rsp_iov); 3569 &rsp_iov);
3501 cifs_small_buf_release(req); 3570 cifs_small_buf_release(req);
3502 rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base; 3571 rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base;
@@ -3651,6 +3720,7 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
3651 const u64 persistent_fid, const u64 volatile_fid, 3720 const u64 persistent_fid, const u64 volatile_fid,
3652 __u8 oplock_level) 3721 __u8 oplock_level)
3653{ 3722{
3723 struct smb_rqst rqst;
3654 int rc; 3724 int rc;
3655 struct smb2_oplock_break *req = NULL; 3725 struct smb2_oplock_break *req = NULL;
3656 struct cifs_ses *ses = tcon->ses; 3726 struct cifs_ses *ses = tcon->ses;
@@ -3679,7 +3749,11 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
3679 iov[0].iov_base = (char *)req; 3749 iov[0].iov_base = (char *)req;
3680 iov[0].iov_len = total_len; 3750 iov[0].iov_len = total_len;
3681 3751
3682 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buf_type, flags, &rsp_iov); 3752 memset(&rqst, 0, sizeof(struct smb_rqst));
3753 rqst.rq_iov = iov;
3754 rqst.rq_nvec = 1;
3755
3756 rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov);
3683 cifs_small_buf_release(req); 3757 cifs_small_buf_release(req);
3684 3758
3685 if (rc) { 3759 if (rc) {
@@ -3742,6 +3816,7 @@ int
3742SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon, 3816SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
3743 u64 persistent_fid, u64 volatile_fid, struct kstatfs *fsdata) 3817 u64 persistent_fid, u64 volatile_fid, struct kstatfs *fsdata)
3744{ 3818{
3819 struct smb_rqst rqst;
3745 struct smb2_query_info_rsp *rsp = NULL; 3820 struct smb2_query_info_rsp *rsp = NULL;
3746 struct kvec iov; 3821 struct kvec iov;
3747 struct kvec rsp_iov; 3822 struct kvec rsp_iov;
@@ -3760,7 +3835,11 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
3760 if (smb3_encryption_required(tcon)) 3835 if (smb3_encryption_required(tcon))
3761 flags |= CIFS_TRANSFORM_REQ; 3836 flags |= CIFS_TRANSFORM_REQ;
3762 3837
3763 rc = smb2_send_recv(xid, ses, &iov, 1, &resp_buftype, flags, &rsp_iov); 3838 memset(&rqst, 0, sizeof(struct smb_rqst));
3839 rqst.rq_iov = &iov;
3840 rqst.rq_nvec = 1;
3841
3842 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
3764 cifs_small_buf_release(iov.iov_base); 3843 cifs_small_buf_release(iov.iov_base);
3765 if (rc) { 3844 if (rc) {
3766 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); 3845 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
@@ -3785,6 +3864,7 @@ int
3785SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, 3864SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
3786 u64 persistent_fid, u64 volatile_fid, int level) 3865 u64 persistent_fid, u64 volatile_fid, int level)
3787{ 3866{
3867 struct smb_rqst rqst;
3788 struct smb2_query_info_rsp *rsp = NULL; 3868 struct smb2_query_info_rsp *rsp = NULL;
3789 struct kvec iov; 3869 struct kvec iov;
3790 struct kvec rsp_iov; 3870 struct kvec rsp_iov;
@@ -3816,7 +3896,11 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
3816 if (smb3_encryption_required(tcon)) 3896 if (smb3_encryption_required(tcon))
3817 flags |= CIFS_TRANSFORM_REQ; 3897 flags |= CIFS_TRANSFORM_REQ;
3818 3898
3819 rc = smb2_send_recv(xid, ses, &iov, 1, &resp_buftype, flags, &rsp_iov); 3899 memset(&rqst, 0, sizeof(struct smb_rqst));
3900 rqst.rq_iov = &iov;
3901 rqst.rq_nvec = 1;
3902
3903 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
3820 cifs_small_buf_release(iov.iov_base); 3904 cifs_small_buf_release(iov.iov_base);
3821 if (rc) { 3905 if (rc) {
3822 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); 3906 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
@@ -3855,6 +3939,7 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
3855 const __u64 persist_fid, const __u64 volatile_fid, const __u32 pid, 3939 const __u64 persist_fid, const __u64 volatile_fid, const __u32 pid,
3856 const __u32 num_lock, struct smb2_lock_element *buf) 3940 const __u32 num_lock, struct smb2_lock_element *buf)
3857{ 3941{
3942 struct smb_rqst rqst;
3858 int rc = 0; 3943 int rc = 0;
3859 struct smb2_lock_req *req = NULL; 3944 struct smb2_lock_req *req = NULL;
3860 struct kvec iov[2]; 3945 struct kvec iov[2];
@@ -3887,7 +3972,12 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
3887 iov[1].iov_len = count; 3972 iov[1].iov_len = count;
3888 3973
3889 cifs_stats_inc(&tcon->stats.cifs_stats.num_locks); 3974 cifs_stats_inc(&tcon->stats.cifs_stats.num_locks);
3890 rc = smb2_send_recv(xid, tcon->ses, iov, 2, &resp_buf_type, flags, 3975
3976 memset(&rqst, 0, sizeof(struct smb_rqst));
3977 rqst.rq_iov = iov;
3978 rqst.rq_nvec = 2;
3979
3980 rc = cifs_send_recv(xid, tcon->ses, &rqst, &resp_buf_type, flags,
3891 &rsp_iov); 3981 &rsp_iov);
3892 cifs_small_buf_release(req); 3982 cifs_small_buf_release(req);
3893 if (rc) { 3983 if (rc) {
@@ -3921,6 +4011,7 @@ int
3921SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, 4011SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
3922 __u8 *lease_key, const __le32 lease_state) 4012 __u8 *lease_key, const __le32 lease_state)
3923{ 4013{
4014 struct smb_rqst rqst;
3924 int rc; 4015 int rc;
3925 struct smb2_lease_ack *req = NULL; 4016 struct smb2_lease_ack *req = NULL;
3926 struct cifs_ses *ses = tcon->ses; 4017 struct cifs_ses *ses = tcon->ses;
@@ -3951,7 +4042,11 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
3951 iov[0].iov_base = (char *)req; 4042 iov[0].iov_base = (char *)req;
3952 iov[0].iov_len = total_len; 4043 iov[0].iov_len = total_len;
3953 4044
3954 rc = smb2_send_recv(xid, ses, iov, 1, &resp_buf_type, flags, &rsp_iov); 4045 memset(&rqst, 0, sizeof(struct smb_rqst));
4046 rqst.rq_iov = iov;
4047 rqst.rq_nvec = 1;
4048
4049 rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov);
3955 cifs_small_buf_release(req); 4050 cifs_small_buf_release(req);
3956 4051
3957 if (rc) { 4052 if (rc) {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 63f25f919b24..8b922ffc2345 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -880,23 +880,6 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
880 return rc; 880 return rc;
881} 881}
882 882
883/* Like SendReceive2 but iov[0] does not contain an rfc1002 header */
884int
885smb2_send_recv(const unsigned int xid, struct cifs_ses *ses,
886 struct kvec *iov, int n_vec, int *resp_buf_type /* ret */,
887 const int flags, struct kvec *resp_iov)
888{
889 struct smb_rqst rqst;
890 int rc;
891
892 memset(&rqst, 0, sizeof(struct smb_rqst));
893 rqst.rq_iov = iov;
894 rqst.rq_nvec = n_vec;
895
896 rc = cifs_send_recv(xid, ses, &rqst, resp_buf_type, flags, resp_iov);
897 return rc;
898}
899
900int 883int
901SendReceive(const unsigned int xid, struct cifs_ses *ses, 884SendReceive(const unsigned int xid, struct cifs_ses *ses,
902 struct smb_hdr *in_buf, struct smb_hdr *out_buf, 885 struct smb_hdr *in_buf, struct smb_hdr *out_buf,