aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2016-09-23 00:44:16 -0500
committerSteve French <smfrench@gmail.com>2016-10-12 12:08:33 -0500
commit141891f4727c08829755be6c785e125d2e96c899 (patch)
treed2c32b7875356357062a0ab67044a4ae7287b689 /fs/cifs/smb2pdu.c
parentfs/cifs: reopen persistent handles on reconnect (diff)
downloadlinux-dev-141891f4727c08829755be6c785e125d2e96c899.tar.xz
linux-dev-141891f4727c08829755be6c785e125d2e96c899.zip
SMB3: Add mount parameter to allow user to override max credits
Add mount option "max_credits" to allow setting maximum SMB3 credits to any value from 10 to 64000 (default is 32000). This can be useful to workaround servers with problems allocating credits, or to throttle the client to use smaller amount of simultaneous i/o or to workaround server performance issues. Also adds a cap, so that even if the server granted us more than 65000 credits due to a server bug, we would not use that many. Signed-off-by: Steve French <steve.french@primarydata.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 4d944c4c55a8..d6a045690266 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -105,11 +105,11 @@ smb2_hdr_assemble(struct smb2_hdr *hdr, __le16 smb2_cmd /* command */ ,
spin_lock(&server->req_lock);
/* Request up to 2 credits but don't go over the limit. */
- if (server->credits >= SMB2_MAX_CREDITS_AVAILABLE)
+ if (server->credits >= server->max_credits)
hdr->CreditRequest = cpu_to_le16(0);
else
hdr->CreditRequest = cpu_to_le16(
- min_t(int, SMB2_MAX_CREDITS_AVAILABLE -
+ min_t(int, server->max_credits -
server->credits, 2));
spin_unlock(&server->req_lock);
} else {