aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifs_debug.c2
-rw-r--r--fs/cifs/connect.c29
-rw-r--r--fs/cifs/file.c5
3 files changed, 28 insertions, 8 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index b7fb064f6548..6f7810992db3 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -267,7 +267,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
267 atomic_read(&tcon->num_oplock_brks)); 267 atomic_read(&tcon->num_oplock_brks));
268 buf += item_length; 268 buf += item_length;
269 length += item_length; 269 length += item_length;
270 item_length = sprintf(buf, "\nReads: %d Bytes %lld", 270 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
271 atomic_read(&tcon->num_reads), 271 atomic_read(&tcon->num_reads),
272 (long long)(tcon->bytes_read)); 272 (long long)(tcon->bytes_read));
273 buf += item_length; 273 buf += item_length;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 31eb9a3bf627..d1c6acee620e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -30,6 +30,7 @@
30#include <linux/mempool.h> 30#include <linux/mempool.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/completion.h> 32#include <linux/completion.h>
33#include <linux/pagevec.h>
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include <asm/processor.h> 35#include <asm/processor.h>
35#include "cifspdu.h" 36#include "cifspdu.h"
@@ -188,6 +189,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
188 server->server_RFC1001_name); 189 server->server_RFC1001_name);
189 } 190 }
190 if(rc) { 191 if(rc) {
192 cERROR(1,("reconnect error %d",rc));
191 msleep(3000); 193 msleep(3000);
192 } else { 194 } else {
193 atomic_inc(&tcpSesReconnectCount); 195 atomic_inc(&tcpSesReconnectCount);
@@ -469,6 +471,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
469 } else { 471 } else {
470 /* give server a second to 472 /* give server a second to
471 clean up before reconnect attempt */ 473 clean up before reconnect attempt */
474 cERROR(1,("sleep before reconnect"));
472 msleep(1000); 475 msleep(1000);
473 /* always try 445 first on reconnect 476 /* always try 445 first on reconnect
474 since we get NACK on some if we ever 477 since we get NACK on some if we ever
@@ -556,6 +559,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
556 dump_smb(smb_buffer, length); 559 dump_smb(smb_buffer, length);
557 if (checkSMB (smb_buffer, smb_buffer->Mid, total_read+4)) { 560 if (checkSMB (smb_buffer, smb_buffer->Mid, total_read+4)) {
558 cERROR(1, ("Bad SMB Received ")); 561 cERROR(1, ("Bad SMB Received "));
562 cifs_dump_mem("smb: ", smb_buffer, 48);
559 continue; 563 continue;
560 } 564 }
561 565
@@ -1383,7 +1387,9 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1383 the default. sock_setsockopt not used because it expects 1387 the default. sock_setsockopt not used because it expects
1384 user space buffer */ 1388 user space buffer */
1385 (*csocket)->sk->sk_rcvtimeo = 7 * HZ; 1389 (*csocket)->sk->sk_rcvtimeo = 7 * HZ;
1386 1390 cERROR(1,("sndbuf %d rcvbuf %d reset to 200K each",(*csocket)->sk->sk_sndbuf, (*csocket)->sk->sk_rcvbuf));
1391 (*csocket)->sk->sk_sndbuf = 300 * 1024;
1392 (*csocket)->sk->sk_rcvbuf = 200 * 1024;
1387 /* send RFC1001 sessinit */ 1393 /* send RFC1001 sessinit */
1388 1394
1389 if(psin_server->sin_port == htons(RFC1001_PORT)) { 1395 if(psin_server->sin_port == htons(RFC1001_PORT)) {
@@ -1736,11 +1742,20 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1736 1742
1737 /* search for existing tcon to this server share */ 1743 /* search for existing tcon to this server share */
1738 if (!rc) { 1744 if (!rc) {
1739 if((volume_info.rsize) && (volume_info.rsize <= CIFSMaxBufSize)) 1745 if(volume_info.rsize > CIFSMaxBufSize) {
1746 cERROR(1,("rsize %d too large, using MaxBufSize",
1747 volume_info.rsize));
1748 cifs_sb->rsize = CIFSMaxBufSize;
1749 } else if((volume_info.rsize) && (volume_info.rsize <= CIFSMaxBufSize))
1740 cifs_sb->rsize = volume_info.rsize; 1750 cifs_sb->rsize = volume_info.rsize;
1741 else 1751 else /* default */
1742 cifs_sb->rsize = srvTcp->maxBuf - MAX_CIFS_HDR_SIZE; /* default */ 1752 cifs_sb->rsize = CIFSMaxBufSize;
1743 if(volume_info.wsize) 1753
1754 if(volume_info.wsize > PAGEVEC_SIZE * PAGE_CACHE_SIZE) {
1755 cERROR(1,("wsize %d too large using 4096 instead",
1756 volume_info.wsize));
1757 cifs_sb->wsize = 4096;
1758 } else if(volume_info.wsize)
1744 cifs_sb->wsize = volume_info.wsize; 1759 cifs_sb->wsize = volume_info.wsize;
1745 else 1760 else
1746 cifs_sb->wsize = CIFSMaxBufSize; /* default */ 1761 cifs_sb->wsize = CIFSMaxBufSize; /* default */
@@ -1895,6 +1910,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1895 cifs_sb->wsize = min(cifs_sb->wsize, 1910 cifs_sb->wsize = min(cifs_sb->wsize,
1896 (tcon->ses->server->maxBuf - 1911 (tcon->ses->server->maxBuf -
1897 MAX_CIFS_HDR_SIZE)); 1912 MAX_CIFS_HDR_SIZE));
1913 if (!(tcon->ses->capabilities & CAP_LARGE_READ_X))
1914 cifs_sb->rsize = min(cifs_sb->rsize,
1915 (tcon->ses->server->maxBuf -
1916 MAX_CIFS_HDR_SIZE));
1898 } 1917 }
1899 1918
1900 /* volume_info.password is freed above when existing session found 1919 /* volume_info.password is freed above when existing session found
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 39b23f4fa6c3..11806c879c47 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -855,7 +855,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
855 struct kvec iov[2]; 855 struct kvec iov[2];
856 unsigned int len; 856 unsigned int len;
857 857
858 len = min(cifs_sb->wsize, 858 len = min((size_t)cifs_sb->wsize,
859 write_size - total_written); 859 write_size - total_written);
860 /* iov[0] is reserved for smb header */ 860 /* iov[0] is reserved for smb header */
861 iov[1].iov_base = (char *)write_data + 861 iov[1].iov_base = (char *)write_data +
@@ -920,7 +920,8 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
920 ((open_file->pfile->f_flags & O_RDWR) || 920 ((open_file->pfile->f_flags & O_RDWR) ||
921 (open_file->pfile->f_flags & O_WRONLY))) { 921 (open_file->pfile->f_flags & O_WRONLY))) {
922 read_unlock(&GlobalSMBSeslock); 922 read_unlock(&GlobalSMBSeslock);
923 if(open_file->invalidHandle) { 923 if((open_file->invalidHandle) &&
924 (!open_file->closePend)) {
924 rc = cifs_reopen_file(&cifs_inode->vfs_inode, 925 rc = cifs_reopen_file(&cifs_inode->vfs_inode,
925 open_file->pfile, FALSE); 926 open_file->pfile, FALSE);
926 /* if it fails, try another handle - might be */ 927 /* if it fails, try another handle - might be */