summaryrefslogtreecommitdiff
path: root/fs/cifs/smb2glob.h
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2016-09-20 15:37:13 +0300
committerSteve French <smfrench@gmail.com>2016-10-12 20:08:31 +0300
commit7d414f396c91a3382e51cf628c1cf0709ad0188b (patch)
tree47f004b98c4de347dda9daca46859c33ea9e8905 /fs/cifs/smb2glob.h
parent9742805d6b1bfb45d7f267648c34fb5bcd347397 (diff)
downloadlinux-7d414f396c91a3382e51cf628c1cf0709ad0188b.tar.xz
cifs: Limit the overall credit acquired
The kernel client requests 2 credits for many operations even though they only use 1 credit (presumably to build up a buffer of credit). Some servers seem to give the client as much credit as is requested. In this case, the amount of credit the client has continues increasing to the point where (server->credits * MAX_BUFFER_SIZE) overflows in smb2_wait_mtu_credits(). Fix this by throttling the credit requests if an set limit is reached. For async requests where the credit charge may be > 1, request as much credit as what is charged. The limit is chosen somewhat arbitrarily. The Windows client defaults to 128 credits, the Windows server allows clients up to 512 credits (or 8192 for Windows 2016), and the NetApp server (and at least one other) does not limit clients at all. Choose a high enough value such that the client shouldn't limit performance. This behavior was seen with a NetApp filer (NetApp Release 9.0RC2). Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> CC: Stable <stable@vger.kernel.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2glob.h')
-rw-r--r--fs/cifs/smb2glob.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/cifs/smb2glob.h b/fs/cifs/smb2glob.h
index 0ffa18094335..238759c146ba 100644
--- a/fs/cifs/smb2glob.h
+++ b/fs/cifs/smb2glob.h
@@ -61,4 +61,14 @@
/* Maximum buffer size value we can send with 1 credit */
#define SMB2_MAX_BUFFER_SIZE 65536
+/*
+ * Maximum number of credits to keep available.
+ * This value is chosen somewhat arbitrarily. The Windows client
+ * defaults to 128 credits, the Windows server allows clients up to
+ * 512 credits, and the NetApp server does not limit clients at all.
+ * Choose a high enough value such that the client shouldn't limit
+ * performance.
+ */
+#define SMB2_MAX_CREDITS_AVAILABLE 32000
+
#endif /* _SMB2_GLOB_H */