Skip to content

Commit 2b80d04

Browse files
committed
Charge at least one credit, if server says that it supports multicredit
In SMB2.1 and later the server will usually set the large MTU flag, and we need to charge at least one credit, if server says that since it supports multicredit. Windows seems to let us get away with putting a zero there, but they confirmed that it is wrong and the spec says to put one there (if the request is under 64K and the CAP_LARGE_MTU was returned during protocol negotiation by the server. CC: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7f65385 commit 2b80d04

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/cifs/smb2pdu.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* fs/cifs/smb2pdu.c
33
*
4-
* Copyright (C) International Business Machines Corp., 2009, 2012
4+
* Copyright (C) International Business Machines Corp., 2009, 2013
55
* Etersoft, 2012
66
* Author(s): Steve French ([email protected])
77
* Pavel Shilovsky ([email protected]) 2012
@@ -108,6 +108,13 @@ smb2_hdr_assemble(struct smb2_hdr *hdr, __le16 smb2_cmd /* command */ ,
108108
if (!tcon)
109109
goto out;
110110

111+
/* BB FIXME when we do write > 64K add +1 for every 64K in req or rsp */
112+
/* GLOBAL_CAP_LARGE_MTU will only be set if dialect > SMB2.02 */
113+
/* See sections 2.2.4 and 3.2.4.1.5 of MS-SMB2 */
114+
if (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)
115+
hdr->CreditCharge = cpu_to_le16(1);
116+
/* else CreditCharge MBZ */
117+
111118
hdr->TreeId = tcon->tid;
112119
/* Uid is not converted */
113120
if (tcon->ses)

0 commit comments

Comments
 (0)