cifs: advertise the right receive buffer size to the server
authorJeff Layton <jlayton@redhat.com>
Tue, 26 Jul 2011 16:20:18 +0000 (12:20 -0400)
committerSteve French <sfrench@us.ibm.com>
Sun, 31 Jul 2011 21:20:58 +0000 (21:20 +0000)
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 <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/sess.c

index d3e619692ee0f0437e26d9d91d61545859f248bc..243d5872051319c78e680fc0965f2119bab8749d 100644 (file)
@@ -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);