aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-10-11 06:41:32 -0400
committerSteve French <smfrench@gmail.com>2011-10-13 00:41:32 -0400
commitc974befa402b5eb2ed115b3083b5a46a4be85a9f (patch)
tree88c5835981e1e306248b9f9c4662510ff5b8d5e1 /fs/cifs/connect.c
parentf3a6a60e4c3ac83370c620dbbd08d2a418b9364d (diff)
cifs: untangle server->maxBuf and CIFSMaxBufSize
server->maxBuf is the maximum SMB size (including header) that the server can handle. CIFSMaxBufSize is the maximum amount of data (sans header) that the client can handle. Currently maxBuf is being capped at CIFSMaxBufSize + the max headers size, and the two values are used somewhat interchangeably in the code. This makes little sense as these two values are not related at all. Separate them and make sure the code uses the right values in the right places. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 71beb0201970..a0077a5e0669 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -181,7 +181,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
181 -EINVAL = invalid transact2 181 -EINVAL = invalid transact2
182 182
183 */ 183 */
184static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize) 184static int check2ndT2(struct smb_hdr *pSMB)
185{ 185{
186 struct smb_t2_rsp *pSMBt; 186 struct smb_t2_rsp *pSMBt;
187 int remaining; 187 int remaining;
@@ -214,9 +214,9 @@ static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize)
214 214
215 cFYI(1, "missing %d bytes from transact2, check next response", 215 cFYI(1, "missing %d bytes from transact2, check next response",
216 remaining); 216 remaining);
217 if (total_data_size > maxBufSize) { 217 if (total_data_size > CIFSMaxBufSize) {
218 cERROR(1, "TotalDataSize %d is over maximum buffer %d", 218 cERROR(1, "TotalDataSize %d is over maximum buffer %d",
219 total_data_size, maxBufSize); 219 total_data_size, CIFSMaxBufSize);
220 return -EINVAL; 220 return -EINVAL;
221 } 221 }
222 return remaining; 222 return remaining;
@@ -486,7 +486,7 @@ find_cifs_mid(struct TCP_Server_Info *server, struct smb_hdr *buf,
486 mid->command != buf->Command) 486 mid->command != buf->Command)
487 continue; 487 continue;
488 488
489 if (*length == 0 && check2ndT2(buf, server->maxBuf) > 0) { 489 if (*length == 0 && check2ndT2(buf) > 0) {
490 /* We have a multipart transact2 resp */ 490 /* We have a multipart transact2 resp */
491 *is_multi_rsp = true; 491 *is_multi_rsp = true;
492 if (mid->resp_buf) { 492 if (mid->resp_buf) {
@@ -3130,8 +3130,7 @@ try_mount_again:
3130 cFYI(DBG2, "no very large read support, rsize now 127K"); 3130 cFYI(DBG2, "no very large read support, rsize now 127K");
3131 } 3131 }
3132 if (!(tcon->ses->capabilities & CAP_LARGE_READ_X)) 3132 if (!(tcon->ses->capabilities & CAP_LARGE_READ_X))
3133 cifs_sb->rsize = min(cifs_sb->rsize, 3133 cifs_sb->rsize = min(cifs_sb->rsize, CIFSMaxBufSize);
3134 (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE));
3135 3134
3136 cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info); 3135 cifs_sb->wsize = cifs_negotiate_wsize(tcon, volume_info);
3137 3136