diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-01-17 16:08:51 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-01-17 23:39:37 -0500 |
commit | ce91acb3acae26f4163c5a6f1f695d1a1e8d9009 (patch) | |
tree | 99fb4bf5e536de370b6d3378199982ff4c829b69 /fs | |
parent | f5fffcee27c09143ba80e5257dbd1f381d86342f (diff) |
cifs: lower default wsize when unix extensions are not used
We've had some reports of servers (namely, the Solaris in-kernel CIFS
server) that don't deal properly with writes that are "too large" even
though they set CAP_LARGE_WRITE_ANDX. Change the default to better
mirror what windows clients do.
Cc: stable@vger.kernel.org
Cc: Pavel Shilovsky <piastry@etersoft.ru>
Reported-by: Nick Davis <phireph0x@yahoo.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/connect.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5cc15856e4ad..a66dcb52988c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2930,18 +2930,33 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2930 | #define CIFS_DEFAULT_IOSIZE (1024 * 1024) | 2930 | #define CIFS_DEFAULT_IOSIZE (1024 * 1024) |
2931 | 2931 | ||
2932 | /* | 2932 | /* |
2933 | * Windows only supports a max of 60k reads. Default to that when posix | 2933 | * Windows only supports a max of 60kb reads and 65535 byte writes. Default to |
2934 | * extensions aren't in force. | 2934 | * those values when posix extensions aren't in force. In actuality here, we |
2935 | * use 65536 to allow for a write that is a multiple of 4k. Most servers seem | ||
2936 | * to be ok with the extra byte even though Windows doesn't send writes that | ||
2937 | * are that large. | ||
2938 | * | ||
2939 | * Citation: | ||
2940 | * | ||
2941 | * http://blogs.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance-tuning.aspx | ||
2935 | */ | 2942 | */ |
2936 | #define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024) | 2943 | #define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024) |
2944 | #define CIFS_DEFAULT_NON_POSIX_WSIZE (65536) | ||
2937 | 2945 | ||
2938 | static unsigned int | 2946 | static unsigned int |
2939 | cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info) | 2947 | cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info) |
2940 | { | 2948 | { |
2941 | __u64 unix_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); | 2949 | __u64 unix_cap = le64_to_cpu(tcon->fsUnixInfo.Capability); |
2942 | struct TCP_Server_Info *server = tcon->ses->server; | 2950 | struct TCP_Server_Info *server = tcon->ses->server; |
2943 | unsigned int wsize = pvolume_info->wsize ? pvolume_info->wsize : | 2951 | unsigned int wsize; |
2944 | CIFS_DEFAULT_IOSIZE; | 2952 | |
2953 | /* start with specified wsize, or default */ | ||
2954 | if (pvolume_info->wsize) | ||
2955 | wsize = pvolume_info->wsize; | ||
2956 | else if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_WRITE_CAP)) | ||
2957 | wsize = CIFS_DEFAULT_IOSIZE; | ||
2958 | else | ||
2959 | wsize = CIFS_DEFAULT_NON_POSIX_WSIZE; | ||
2945 | 2960 | ||
2946 | /* can server support 24-bit write sizes? (via UNIX extensions) */ | 2961 | /* can server support 24-bit write sizes? (via UNIX extensions) */ |
2947 | if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP)) | 2962 | if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP)) |