cifs: add resp_buf_size to the mid_q_entry structure
authorRonnie Sahlberg <lsahlber@redhat.com>
Mon, 9 Apr 2018 08:06:28 +0000 (18:06 +1000)
committerSteve French <smfrench@gmail.com>
Fri, 13 Apr 2018 01:32:48 +0000 (20:32 -0500)
and get rid of some more calls to get_rfc1002_length()

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/smb2transport.c
fs/cifs/transport.c

index 5c1568ccd67d575839543cd8e8a06b41631855df..cb950a5fa0782e9d3446a8a0bc3a8fdd642bc57e 100644 (file)
@@ -1376,6 +1376,7 @@ struct mid_q_entry {
        mid_handle_t *handle; /* call handle mid callback */
        void *callback_data;      /* general purpose pointer for callback */
        void *resp_buf;         /* pointer to received SMB header */
+       unsigned int resp_buf_size;
        int mid_state;  /* wish this were enum but can not pass to wait_event */
        unsigned int mid_flags;
        __le16 command;         /* smb command code */
index 48012a0addf1ca1fd99f3d9bda0011ffb7d4dd9f..e8830f076a7f16a056f7eec3cf025e0e30bff9e8 100644 (file)
@@ -928,6 +928,7 @@ cifs_demultiplex_thread(void *p)
 
                server->lstrp = jiffies;
                if (mid_entry != NULL) {
+                       mid_entry->resp_buf_size = server->pdu_size;
                        if ((mid_entry->mid_flags & MID_WAIT_CANCELLED) &&
                             mid_entry->mid_state == MID_RESPONSE_RECEIVED &&
                                        server->ops->handle_cancelled_mid)
index bf49cb73b9e6ad80f4e67b961e22640fda6df3db..8806f3f76c1d6c25c88bf98ba66aadd332d73b09 100644 (file)
@@ -604,7 +604,7 @@ int
 smb2_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
                   bool log_error)
 {
-       unsigned int len = get_rfc1002_length(mid->resp_buf);
+       unsigned int len = mid->resp_buf_size;
        struct kvec iov[2];
        struct smb_rqst rqst = { .rq_iov = iov,
                                 .rq_nvec = 2 };
index 279718dcb2edb0960bd772d5fc356932a4556747..8f6f25918229d9aeb680173a87cf9d684d2eb5c8 100644 (file)
@@ -790,7 +790,7 @@ cifs_send_recv(const unsigned int xid, struct cifs_ses *ses,
 
        buf = (char *)midQ->resp_buf;
        resp_iov->iov_base = buf;
-       resp_iov->iov_len = get_rfc1002_length(buf) +
+       resp_iov->iov_len = midQ->resp_buf_size +
                ses->server->vals->header_preamble_size;
        if (midQ->large_buf)
                *resp_buf_type = CIFS_LARGE_BUFFER;