diff options
author | Steve French <smfrench@gmail.com> | 2016-09-23 08:44:16 +0300 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2016-10-12 20:08:33 +0300 |
commit | 141891f4727c08829755be6c785e125d2e96c899 (patch) | |
tree | d2c32b7875356357062a0ab67044a4ae7287b689 /fs/cifs/smb2ops.c | |
parent | 52ace1ef1259e119a24a34b45cb800c4e7529090 (diff) | |
download | linux-141891f4727c08829755be6c785e125d2e96c899.tar.xz |
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/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 91e53df4e420..378260cd25a6 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -70,6 +70,10 @@ smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add, spin_lock(&server->req_lock); val = server->ops->get_credits_field(server, optype); *val += add; + if (*val > 65000) { + *val = 65000; /* Don't get near 64K credits, avoid srv bugs */ + printk_once(KERN_WARNING "server overflowed SMB3 credits\n"); + } server->in_flight--; if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP) rc = change_conf(server); |