From: Jeff Layton Date: Tue, 26 Jul 2011 16:20:18 +0000 (-0400) Subject: cifs: advertise the right receive buffer size to the server X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c4d3396b261473ded6f370edd1e79ba34e089d7e;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git cifs: advertise the right receive buffer size to the server Currently, we mirror the same size back to the server that it sends us. That makes little sense. Instead we should be sending the server the maximum buffer size that we can handle -- CIFSMaxBufSize minus the 4 byte RFC1001 header. Signed-off-by: Jeff Layton Signed-off-by: Steve French --- diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index d3e619692ee0..243d58720513 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -124,7 +124,8 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB) /* that we use in next few lines */ /* Note that header is initialized to zero in header_assemble */ pSMB->req.AndXCommand = 0xFF; - pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); + pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32, CIFSMaxBufSize - 4, + USHRT_MAX)); pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); pSMB->req.VcNumber = get_next_vcnum(ses);