提交 2e96467d 编写于 作者: R Ronnie Sahlberg 提交者: Steve French

cifs: add pdu_size to the TCP_Server_Info structure

and get rid of some get_rfc1002_length() in smb2
Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: NSteve French <smfrench@gmail.com>
Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
上级 5100d8a3
...@@ -665,6 +665,8 @@ struct TCP_Server_Info { ...@@ -665,6 +665,8 @@ struct TCP_Server_Info {
struct delayed_work echo; /* echo ping workqueue job */ struct delayed_work echo; /* echo ping workqueue job */
char *smallbuf; /* pointer to current "small" buffer */ char *smallbuf; /* pointer to current "small" buffer */
char *bigbuf; /* pointer to current "big" buffer */ char *bigbuf; /* pointer to current "big" buffer */
/* Total size of this PDU. Only valid from cifs_demultiplex_thread */
unsigned int pdu_size;
unsigned int total_read; /* total amount of data read in this pass */ unsigned int total_read; /* total amount of data read in this pass */
#ifdef CONFIG_CIFS_FSCACHE #ifdef CONFIG_CIFS_FSCACHE
struct fscache_cookie *fscache; /* client index cache cookie */ struct fscache_cookie *fscache; /* client index cache cookie */
......
...@@ -1456,7 +1456,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) ...@@ -1456,7 +1456,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
unsigned int data_offset, data_len; unsigned int data_offset, data_len;
struct cifs_readdata *rdata = mid->callback_data; struct cifs_readdata *rdata = mid->callback_data;
char *buf = server->smallbuf; char *buf = server->smallbuf;
unsigned int buflen = get_rfc1002_length(buf) + unsigned int buflen = server->pdu_size +
server->vals->header_preamble_size; server->vals->header_preamble_size;
bool use_rdma_mr = false; bool use_rdma_mr = false;
......
...@@ -772,7 +772,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid) ...@@ -772,7 +772,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
{ {
int length; int length;
char *buf = server->smallbuf; char *buf = server->smallbuf;
unsigned int pdu_length = get_rfc1002_length(buf); unsigned int pdu_length = server->pdu_size;
/* make sure this will fit in a large buffer */ /* make sure this will fit in a large buffer */
if (pdu_length > CIFSMaxBufSize + MAX_HEADER_SIZE(server) - if (pdu_length > CIFSMaxBufSize + MAX_HEADER_SIZE(server) -
...@@ -881,6 +881,7 @@ cifs_demultiplex_thread(void *p) ...@@ -881,6 +881,7 @@ cifs_demultiplex_thread(void *p)
* so we can now interpret the length field. * so we can now interpret the length field.
*/ */
pdu_length = get_rfc1002_length(buf); pdu_length = get_rfc1002_length(buf);
server->pdu_size = pdu_length;
cifs_dbg(FYI, "RFC1002 header 0x%x\n", pdu_length); cifs_dbg(FYI, "RFC1002 header 0x%x\n", pdu_length);
if (!is_smb_response(server, buf[0])) if (!is_smb_response(server, buf[0]))
......
...@@ -2550,7 +2550,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid) ...@@ -2550,7 +2550,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid)
unsigned int npages; unsigned int npages;
struct page **pages; struct page **pages;
unsigned int len; unsigned int len;
unsigned int buflen = get_rfc1002_length(buf) + server->vals->header_preamble_size; unsigned int buflen = server->pdu_size + server->vals->header_preamble_size;
int rc; int rc;
int i = 0; int i = 0;
...@@ -2624,7 +2624,7 @@ receive_encrypted_standard(struct TCP_Server_Info *server, ...@@ -2624,7 +2624,7 @@ receive_encrypted_standard(struct TCP_Server_Info *server,
{ {
int length; int length;
char *buf = server->smallbuf; char *buf = server->smallbuf;
unsigned int pdu_length = get_rfc1002_length(buf); unsigned int pdu_length = server->pdu_size;
unsigned int buf_size; unsigned int buf_size;
struct mid_q_entry *mid_entry; struct mid_q_entry *mid_entry;
...@@ -2668,7 +2668,7 @@ static int ...@@ -2668,7 +2668,7 @@ static int
smb3_receive_transform(struct TCP_Server_Info *server, struct mid_q_entry **mid) smb3_receive_transform(struct TCP_Server_Info *server, struct mid_q_entry **mid)
{ {
char *buf = server->smallbuf; char *buf = server->smallbuf;
unsigned int pdu_length = get_rfc1002_length(buf); unsigned int pdu_length = server->pdu_size;
struct smb2_transform_hdr *tr_hdr = (struct smb2_transform_hdr *)buf; struct smb2_transform_hdr *tr_hdr = (struct smb2_transform_hdr *)buf;
unsigned int orig_len = le32_to_cpu(tr_hdr->OriginalMessageSize); unsigned int orig_len = le32_to_cpu(tr_hdr->OriginalMessageSize);
...@@ -2699,7 +2699,7 @@ smb3_handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid) ...@@ -2699,7 +2699,7 @@ smb3_handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid)
{ {
char *buf = server->large_buf ? server->bigbuf : server->smallbuf; char *buf = server->large_buf ? server->bigbuf : server->smallbuf;
return handle_read_data(server, mid, buf, get_rfc1002_length(buf) + return handle_read_data(server, mid, buf, server->pdu_size +
server->vals->header_preamble_size, server->vals->header_preamble_size,
NULL, 0, 0); NULL, 0, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册