aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsglob.h9
-rw-r--r--fs/cifs/cifssmb.c8
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/file.c44
-rw-r--r--fs/cifs/sess.c2
-rw-r--r--fs/cifs/transport.c2
6 files changed, 17 insertions, 50 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 7040abc638fa..571132c95231 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -636,12 +636,9 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
636#define CIFS_IOVEC 4 /* array of response buffers */ 636#define CIFS_IOVEC 4 /* array of response buffers */
637 637
638/* Type of Request to SendReceive2 */ 638/* Type of Request to SendReceive2 */
639#define CIFS_STD_OP 0 /* normal request timeout */ 639#define CIFS_BLOCKING_OP 1 /* operation can block */
640#define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */ 640#define CIFS_ASYNC_OP 2 /* do not wait for response */
641#define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */ 641#define CIFS_TIMEOUT_MASK 0x003 /* only one of above set in req */
642#define CIFS_BLOCKING_OP 4 /* operation can block */
643#define CIFS_ASYNC_OP 8 /* do not wait for response */
644#define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */
645#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */ 642#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
646#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */ 643#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */
647#define CIFS_NO_RESP 0x040 /* no response buffer required */ 644#define CIFS_NO_RESP 0x040 /* no response buffer required */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 54b9f5d8d1db..37113450757b 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1240,7 +1240,7 @@ OldOpenRetry:
1240 pSMB->ByteCount = cpu_to_le16(count); 1240 pSMB->ByteCount = cpu_to_le16(count);
1241 /* long_op set to 1 to allow for oplock break timeouts */ 1241 /* long_op set to 1 to allow for oplock break timeouts */
1242 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1242 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1243 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); 1243 (struct smb_hdr *)pSMBr, &bytes_returned, 0);
1244 cifs_stats_inc(&tcon->num_opens); 1244 cifs_stats_inc(&tcon->num_opens);
1245 if (rc) { 1245 if (rc) {
1246 cFYI(1, "Error in Open = %d", rc); 1246 cFYI(1, "Error in Open = %d", rc);
@@ -1353,7 +1353,7 @@ openRetry:
1353 pSMB->ByteCount = cpu_to_le16(count); 1353 pSMB->ByteCount = cpu_to_le16(count);
1354 /* long_op set to 1 to allow for oplock break timeouts */ 1354 /* long_op set to 1 to allow for oplock break timeouts */
1355 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1355 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1356 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); 1356 (struct smb_hdr *)pSMBr, &bytes_returned, 0);
1357 cifs_stats_inc(&tcon->num_opens); 1357 cifs_stats_inc(&tcon->num_opens);
1358 if (rc) { 1358 if (rc) {
1359 cFYI(1, "Error in Open = %d", rc); 1359 cFYI(1, "Error in Open = %d", rc);
@@ -1435,7 +1435,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1435 iov[0].iov_base = (char *)pSMB; 1435 iov[0].iov_base = (char *)pSMB;
1436 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 1436 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1437 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, 1437 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1438 &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR); 1438 &resp_buf_type, CIFS_LOG_ERROR);
1439 cifs_stats_inc(&tcon->num_reads); 1439 cifs_stats_inc(&tcon->num_reads);
1440 pSMBr = (READ_RSP *)iov[0].iov_base; 1440 pSMBr = (READ_RSP *)iov[0].iov_base;
1441 if (rc) { 1441 if (rc) {
@@ -3136,7 +3136,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3136 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 3136 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
3137 3137
3138 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 3138 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
3139 CIFS_STD_OP); 3139 0);
3140 cifs_stats_inc(&tcon->num_acl_get); 3140 cifs_stats_inc(&tcon->num_acl_get);
3141 if (rc) { 3141 if (rc) {
3142 cFYI(1, "Send error in QuerySecDesc = %d", rc); 3142 cFYI(1, "Send error in QuerySecDesc = %d", rc);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index f5d7b59a3553..8d4657596301 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3022,7 +3022,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3022 pSMB->ByteCount = cpu_to_le16(count); 3022 pSMB->ByteCount = cpu_to_le16(count);
3023 3023
3024 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 3024 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
3025 CIFS_STD_OP); 3025 0);
3026 3026
3027 /* above now done in SendReceive */ 3027 /* above now done in SendReceive */
3028 if ((rc == 0) && (tcon != NULL)) { 3028 if ((rc == 0) && (tcon != NULL)) {
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index cfa2e5ebcafe..bd2a028af833 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -839,29 +839,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
839 return rc; 839 return rc;
840} 840}
841 841
842/*
843 * Set the timeout on write requests past EOF. For some servers (Windows)
844 * these calls can be very long.
845 *
846 * If we're writing >10M past the EOF we give a 180s timeout. Anything less
847 * than that gets a 45s timeout. Writes not past EOF get 15s timeouts.
848 * The 10M cutoff is totally arbitrary. A better scheme for this would be
849 * welcome if someone wants to suggest one.
850 *
851 * We may be able to do a better job with this if there were some way to
852 * declare that a file should be sparse.
853 */
854static int
855cifs_write_timeout(struct cifsInodeInfo *cifsi, loff_t offset)
856{
857 if (offset <= cifsi->server_eof)
858 return CIFS_STD_OP;
859 else if (offset > (cifsi->server_eof + (10 * 1024 * 1024)))
860 return CIFS_VLONG_OP;
861 else
862 return CIFS_LONG_OP;
863}
864
865/* update the file size (if needed) after a write */ 842/* update the file size (if needed) after a write */
866static void 843static void
867cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, 844cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
@@ -882,7 +859,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
882 unsigned int total_written; 859 unsigned int total_written;
883 struct cifs_sb_info *cifs_sb; 860 struct cifs_sb_info *cifs_sb;
884 struct cifsTconInfo *pTcon; 861 struct cifsTconInfo *pTcon;
885 int xid, long_op; 862 int xid;
886 struct cifsFileInfo *open_file; 863 struct cifsFileInfo *open_file;
887 struct cifsInodeInfo *cifsi = CIFS_I(inode); 864 struct cifsInodeInfo *cifsi = CIFS_I(inode);
888 865
@@ -903,7 +880,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
903 880
904 xid = GetXid(); 881 xid = GetXid();
905 882
906 long_op = cifs_write_timeout(cifsi, *poffset);
907 for (total_written = 0; write_size > total_written; 883 for (total_written = 0; write_size > total_written;
908 total_written += bytes_written) { 884 total_written += bytes_written) {
909 rc = -EAGAIN; 885 rc = -EAGAIN;
@@ -931,7 +907,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
931 min_t(const int, cifs_sb->wsize, 907 min_t(const int, cifs_sb->wsize,
932 write_size - total_written), 908 write_size - total_written),
933 *poffset, &bytes_written, 909 *poffset, &bytes_written,
934 NULL, write_data + total_written, long_op); 910 NULL, write_data + total_written, 0);
935 } 911 }
936 if (rc || (bytes_written == 0)) { 912 if (rc || (bytes_written == 0)) {
937 if (total_written) 913 if (total_written)
@@ -944,8 +920,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
944 cifs_update_eof(cifsi, *poffset, bytes_written); 920 cifs_update_eof(cifsi, *poffset, bytes_written);
945 *poffset += bytes_written; 921 *poffset += bytes_written;
946 } 922 }
947 long_op = CIFS_STD_OP; /* subsequent writes fast -
948 15 seconds is plenty */
949 } 923 }
950 924
951 cifs_stats_bytes_written(pTcon, total_written); 925 cifs_stats_bytes_written(pTcon, total_written);
@@ -974,7 +948,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
974 unsigned int total_written; 948 unsigned int total_written;
975 struct cifs_sb_info *cifs_sb; 949 struct cifs_sb_info *cifs_sb;
976 struct cifsTconInfo *pTcon; 950 struct cifsTconInfo *pTcon;
977 int xid, long_op; 951 int xid;
978 struct dentry *dentry = open_file->dentry; 952 struct dentry *dentry = open_file->dentry;
979 struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); 953 struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode);
980 954
@@ -987,7 +961,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
987 961
988 xid = GetXid(); 962 xid = GetXid();
989 963
990 long_op = cifs_write_timeout(cifsi, *poffset);
991 for (total_written = 0; write_size > total_written; 964 for (total_written = 0; write_size > total_written;
992 total_written += bytes_written) { 965 total_written += bytes_written) {
993 rc = -EAGAIN; 966 rc = -EAGAIN;
@@ -1017,7 +990,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1017 rc = CIFSSMBWrite2(xid, pTcon, 990 rc = CIFSSMBWrite2(xid, pTcon,
1018 open_file->netfid, len, 991 open_file->netfid, len,
1019 *poffset, &bytes_written, 992 *poffset, &bytes_written,
1020 iov, 1, long_op); 993 iov, 1, 0);
1021 } else 994 } else
1022 rc = CIFSSMBWrite(xid, pTcon, 995 rc = CIFSSMBWrite(xid, pTcon,
1023 open_file->netfid, 996 open_file->netfid,
@@ -1025,7 +998,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1025 write_size - total_written), 998 write_size - total_written),
1026 *poffset, &bytes_written, 999 *poffset, &bytes_written,
1027 write_data + total_written, 1000 write_data + total_written,
1028 NULL, long_op); 1001 NULL, 0);
1029 } 1002 }
1030 if (rc || (bytes_written == 0)) { 1003 if (rc || (bytes_written == 0)) {
1031 if (total_written) 1004 if (total_written)
@@ -1038,8 +1011,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1038 cifs_update_eof(cifsi, *poffset, bytes_written); 1011 cifs_update_eof(cifsi, *poffset, bytes_written);
1039 *poffset += bytes_written; 1012 *poffset += bytes_written;
1040 } 1013 }
1041 long_op = CIFS_STD_OP; /* subsequent writes fast -
1042 15 seconds is plenty */
1043 } 1014 }
1044 1015
1045 cifs_stats_bytes_written(pTcon, total_written); 1016 cifs_stats_bytes_written(pTcon, total_written);
@@ -1239,7 +1210,7 @@ static int cifs_writepages(struct address_space *mapping,
1239 struct pagevec pvec; 1210 struct pagevec pvec;
1240 int rc = 0; 1211 int rc = 0;
1241 int scanned = 0; 1212 int scanned = 0;
1242 int xid, long_op; 1213 int xid;
1243 1214
1244 cifs_sb = CIFS_SB(mapping->host->i_sb); 1215 cifs_sb = CIFS_SB(mapping->host->i_sb);
1245 1216
@@ -1384,11 +1355,10 @@ retry_write:
1384 cERROR(1, "No writable handles for inode"); 1355 cERROR(1, "No writable handles for inode");
1385 rc = -EBADF; 1356 rc = -EBADF;
1386 } else { 1357 } else {
1387 long_op = cifs_write_timeout(cifsi, offset);
1388 rc = CIFSSMBWrite2(xid, tcon, open_file->netfid, 1358 rc = CIFSSMBWrite2(xid, tcon, open_file->netfid,
1389 bytes_to_write, offset, 1359 bytes_to_write, offset,
1390 &bytes_written, iov, n_iov, 1360 &bytes_written, iov, n_iov,
1391 long_op); 1361 0);
1392 cifsFileInfo_put(open_file); 1362 cifsFileInfo_put(open_file);
1393 } 1363 }
1394 1364
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index eb746486e49e..1cffd82c4f13 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -879,7 +879,7 @@ ssetup_ntlmssp_authenticate:
879 BCC_LE(smb_buf) = cpu_to_le16(count); 879 BCC_LE(smb_buf) = cpu_to_le16(count);
880 880
881 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type, 881 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type,
882 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR); 882 CIFS_LOG_ERROR);
883 /* SMB request buf freed in SendReceive2 */ 883 /* SMB request buf freed in SendReceive2 */
884 884
885 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base; 885 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base;
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index a0cef4960516..fe92c4cb75f5 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -798,7 +798,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon,
798 pSMB->hdr.Mid = GetNextMid(ses->server); 798 pSMB->hdr.Mid = GetNextMid(ses->server);
799 799
800 return SendReceive(xid, ses, in_buf, out_buf, 800 return SendReceive(xid, ses, in_buf, out_buf,
801 &bytes_returned, CIFS_STD_OP); 801 &bytes_returned, 0);
802} 802}
803 803
804int 804int