Skip to contentSkip to conversation

cifs: advertise the right receive buffer size to the server (try #2)

PATCH New Jeff Layton 1 participant 1 message Jun 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: advertise the right receive buffer size to the server (try #2)

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.

---
 fs/cifs/sess.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/cifs/sess.c +2 -1
index 3892ab8..7ee3d75 100644
@@ -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);
 
Signature · 1 line
1.7.5.4