diff options
author | Steve French <sfrench@us.ibm.com> | 2006-07-14 18:37:11 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-08-11 17:27:07 -0400 |
commit | 3a5ff61c18659443f76bad6cf06f60103046de5d (patch) | |
tree | 541e341724b50b11c598c9790370d460f189586b | |
parent | 9f737633e6ee54fc174282d49b2559bd2208391d (diff) |
[CIFS] Do not time out posix brl requests when using new posix setfileinfo
request and do not time out slow requests to a server that is still responding
well to other threads
Suggested by jra of Samba team
Signed-off-by: Steve French <sfrench@us.ibm.com>
(cherry picked from 89b57148115479eef074b8d3f86c4c86c96ac969 commit)
-rw-r--r-- | fs/cifs/CHANGES | 6 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 6 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 11 | ||||
-rw-r--r-- | fs/cifs/connect.c | 17 | ||||
-rw-r--r-- | fs/cifs/file.c | 6 | ||||
-rw-r--r-- | fs/cifs/transport.c | 16 |
8 files changed, 49 insertions, 18 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index a61d17ed1827..acb843b9bc3b 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,9 @@ | |||
1 | Version 1.45 | ||
2 | ------------ | ||
3 | Do not time out lockw calls when using posix extensions. Do not | ||
4 | time out requests if server still responding reasonably fast | ||
5 | on requests on other threads | ||
6 | |||
1 | Version 1.44 | 7 | Version 1.44 |
2 | ------------ | 8 | ------------ |
3 | Rewritten sessionsetup support, including support for legacy SMB | 9 | Rewritten sessionsetup support, including support for legacy SMB |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index c28ede599946..3cd750029be2 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -402,7 +402,6 @@ static struct quotactl_ops cifs_quotactl_ops = { | |||
402 | }; | 402 | }; |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
406 | static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags) | 405 | static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags) |
407 | { | 406 | { |
408 | struct cifs_sb_info *cifs_sb; | 407 | struct cifs_sb_info *cifs_sb; |
@@ -422,7 +421,7 @@ static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags) | |||
422 | tcon->tidStatus = CifsExiting; | 421 | tcon->tidStatus = CifsExiting; |
423 | up(&tcon->tconSem); | 422 | up(&tcon->tconSem); |
424 | 423 | ||
425 | /* cancel_brl_requests(tcon); */ | 424 | /* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ |
426 | /* cancel_notify_requests(tcon); */ | 425 | /* cancel_notify_requests(tcon); */ |
427 | if(tcon->ses && tcon->ses->server) | 426 | if(tcon->ses && tcon->ses->server) |
428 | { | 427 | { |
@@ -438,7 +437,6 @@ static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags) | |||
438 | 437 | ||
439 | return; | 438 | return; |
440 | } | 439 | } |
441 | #endif | ||
442 | 440 | ||
443 | static int cifs_remount(struct super_block *sb, int *flags, char *data) | 441 | static int cifs_remount(struct super_block *sb, int *flags, char *data) |
444 | { | 442 | { |
@@ -457,9 +455,7 @@ struct super_operations cifs_super_ops = { | |||
457 | unless later we add lazy close of inodes or unless the kernel forgets to call | 455 | unless later we add lazy close of inodes or unless the kernel forgets to call |
458 | us with the same number of releases (closes) as opens */ | 456 | us with the same number of releases (closes) as opens */ |
459 | .show_options = cifs_show_options, | 457 | .show_options = cifs_show_options, |
460 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
461 | .umount_begin = cifs_umount_begin, | 458 | .umount_begin = cifs_umount_begin, |
462 | #endif | ||
463 | .remount_fs = cifs_remount, | 459 | .remount_fs = cifs_remount, |
464 | }; | 460 | }; |
465 | 461 | ||
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 8f75c6f24701..39ee8ef3bdeb 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -100,5 +100,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | |||
100 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 100 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
101 | extern int cifs_ioctl (struct inode * inode, struct file * filep, | 101 | extern int cifs_ioctl (struct inode * inode, struct file * filep, |
102 | unsigned int command, unsigned long arg); | 102 | unsigned int command, unsigned long arg); |
103 | #define CIFS_VERSION "1.44" | 103 | #define CIFS_VERSION "1.45" |
104 | #endif /* _CIFSFS_H */ | 104 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 6d7cf5f3bc0b..39b43e6a7509 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -158,7 +158,8 @@ struct TCP_Server_Info { | |||
158 | /* 16th byte of RFC1001 workstation name is always null */ | 158 | /* 16th byte of RFC1001 workstation name is always null */ |
159 | char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; | 159 | char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; |
160 | __u32 sequence_number; /* needed for CIFS PDU signature */ | 160 | __u32 sequence_number; /* needed for CIFS PDU signature */ |
161 | char mac_signing_key[CIFS_SESS_KEY_SIZE + 16]; | 161 | char mac_signing_key[CIFS_SESS_KEY_SIZE + 16]; |
162 | unsigned long lstrp; /* when we got last response from this server */ | ||
162 | }; | 163 | }; |
163 | 164 | ||
164 | /* | 165 | /* |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 19678c575dfc..c03c42ee9eb9 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1484,6 +1484,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1484 | char *data_offset; | 1484 | char *data_offset; |
1485 | struct cifs_posix_lock *parm_data; | 1485 | struct cifs_posix_lock *parm_data; |
1486 | int rc = 0; | 1486 | int rc = 0; |
1487 | int timeout = 0; | ||
1487 | int bytes_returned = 0; | 1488 | int bytes_returned = 0; |
1488 | __u16 params, param_offset, offset, byte_count, count; | 1489 | __u16 params, param_offset, offset, byte_count, count; |
1489 | 1490 | ||
@@ -1503,7 +1504,6 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1503 | pSMB->MaxSetupCount = 0; | 1504 | pSMB->MaxSetupCount = 0; |
1504 | pSMB->Reserved = 0; | 1505 | pSMB->Reserved = 0; |
1505 | pSMB->Flags = 0; | 1506 | pSMB->Flags = 0; |
1506 | pSMB->Timeout = 0; | ||
1507 | pSMB->Reserved2 = 0; | 1507 | pSMB->Reserved2 = 0; |
1508 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 1508 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
1509 | offset = param_offset + params; | 1509 | offset = param_offset + params; |
@@ -1529,8 +1529,13 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1529 | (((char *) &pSMB->hdr.Protocol) + offset); | 1529 | (((char *) &pSMB->hdr.Protocol) + offset); |
1530 | 1530 | ||
1531 | parm_data->lock_type = cpu_to_le16(lock_type); | 1531 | parm_data->lock_type = cpu_to_le16(lock_type); |
1532 | if(waitFlag) | 1532 | if(waitFlag) { |
1533 | timeout = 3; /* blocking operation, no timeout */ | ||
1533 | parm_data->lock_flags = cpu_to_le16(1); | 1534 | parm_data->lock_flags = cpu_to_le16(1); |
1535 | pSMB->Timeout = cpu_to_le32(-1); | ||
1536 | } else | ||
1537 | pSMB->Timeout = 0; | ||
1538 | |||
1534 | parm_data->pid = cpu_to_le32(current->tgid); | 1539 | parm_data->pid = cpu_to_le32(current->tgid); |
1535 | parm_data->start = cpu_to_le64(pLockData->fl_start); | 1540 | parm_data->start = cpu_to_le64(pLockData->fl_start); |
1536 | parm_data->length = cpu_to_le64(len); /* normalize negative numbers */ | 1541 | parm_data->length = cpu_to_le64(len); /* normalize negative numbers */ |
@@ -1542,7 +1547,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1542 | pSMB->hdr.smb_buf_length += byte_count; | 1547 | pSMB->hdr.smb_buf_length += byte_count; |
1543 | pSMB->ByteCount = cpu_to_le16(byte_count); | 1548 | pSMB->ByteCount = cpu_to_le16(byte_count); |
1544 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1549 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1545 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1550 | (struct smb_hdr *) pSMBr, &bytes_returned, timeout); |
1546 | if (rc) { | 1551 | if (rc) { |
1547 | cFYI(1, ("Send error in Posix Lock = %d", rc)); | 1552 | cFYI(1, ("Send error in Posix Lock = %d", rc)); |
1548 | } else if (get_flag) { | 1553 | } else if (get_flag) { |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 876eb9ef85fe..c4aedcf5c924 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -612,6 +612,10 @@ multi_t2_fnd: | |||
612 | #ifdef CONFIG_CIFS_STATS2 | 612 | #ifdef CONFIG_CIFS_STATS2 |
613 | mid_entry->when_received = jiffies; | 613 | mid_entry->when_received = jiffies; |
614 | #endif | 614 | #endif |
615 | /* so we do not time out requests to server | ||
616 | which is still responding (since server could | ||
617 | be busy but not dead) */ | ||
618 | server->lstrp = jiffies; | ||
615 | break; | 619 | break; |
616 | } | 620 | } |
617 | } | 621 | } |
@@ -1969,7 +1973,18 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1969 | } | 1973 | } |
1970 | 1974 | ||
1971 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); | 1975 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); |
1972 | 1976 | #ifdef CONFIG_CIFS_DEBUG2 | |
1977 | if(cap & CIFS_UNIX_FCNTL_CAP) | ||
1978 | cFYI(1,("FCNTL cap")); | ||
1979 | if(cap & CIFS_UNIX_EXTATTR_CAP) | ||
1980 | cFYI(1,("EXTATTR cap")); | ||
1981 | if(cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) | ||
1982 | cFYI(1,("POSIX path cap")); | ||
1983 | if(cap & CIFS_UNIX_XATTR_CAP) | ||
1984 | cFYI(1,("XATTR cap")); | ||
1985 | if(cap & CIFS_UNIX_POSIX_ACL_CAP) | ||
1986 | cFYI(1,("POSIX ACL cap")); | ||
1987 | #endif /* CIFS_DEBUG2 */ | ||
1973 | if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { | 1988 | if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { |
1974 | cFYI(1,("setting capabilities failed")); | 1989 | cFYI(1,("setting capabilities failed")); |
1975 | } | 1990 | } |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 944d2b9e092d..52e2e4c8794b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -644,8 +644,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
644 | account for negative length which we can not accept over the | 644 | account for negative length which we can not accept over the |
645 | wire */ | 645 | wire */ |
646 | if (IS_GETLK(cmd)) { | 646 | if (IS_GETLK(cmd)) { |
647 | if(experimEnabled && | 647 | if((cifs_sb->tcon->ses->capabilities & CAP_UNIX) && |
648 | (cifs_sb->tcon->ses->capabilities & CAP_UNIX) && | ||
649 | (CIFS_UNIX_FCNTL_CAP & | 648 | (CIFS_UNIX_FCNTL_CAP & |
650 | le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) { | 649 | le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) { |
651 | int posix_lock_type; | 650 | int posix_lock_type; |
@@ -683,8 +682,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
683 | FreeXid(xid); | 682 | FreeXid(xid); |
684 | return rc; | 683 | return rc; |
685 | } | 684 | } |
686 | if (experimEnabled && | 685 | if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) && |
687 | (cifs_sb->tcon->ses->capabilities & CAP_UNIX) && | ||
688 | (CIFS_UNIX_FCNTL_CAP & | 686 | (CIFS_UNIX_FCNTL_CAP & |
689 | le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) { | 687 | le64_to_cpu(cifs_sb->tcon->fsUnixInfo.Capability))) { |
690 | int posix_lock_type; | 688 | int posix_lock_type; |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 17ba329e2b3d..95e23ca670a8 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -444,8 +444,9 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
444 | if(timeout != MAX_SCHEDULE_TIMEOUT) { | 444 | if(timeout != MAX_SCHEDULE_TIMEOUT) { |
445 | timeout += jiffies; | 445 | timeout += jiffies; |
446 | wait_event(ses->server->response_q, | 446 | wait_event(ses->server->response_q, |
447 | (!(midQ->midState & MID_REQUEST_SUBMITTED)) || | 447 | (!(midQ->midState & MID_REQUEST_SUBMITTED)) || |
448 | time_after(jiffies, timeout) || | 448 | (time_after(jiffies, timeout) && |
449 | time_after(jiffies, ses->server->lstrp + HZ)) || | ||
449 | ((ses->server->tcpStatus != CifsGood) && | 450 | ((ses->server->tcpStatus != CifsGood) && |
450 | (ses->server->tcpStatus != CifsNew))); | 451 | (ses->server->tcpStatus != CifsNew))); |
451 | } else { | 452 | } else { |
@@ -710,9 +711,18 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
710 | /* No user interrupts in wait - wreaks havoc with performance */ | 711 | /* No user interrupts in wait - wreaks havoc with performance */ |
711 | if(timeout != MAX_SCHEDULE_TIMEOUT) { | 712 | if(timeout != MAX_SCHEDULE_TIMEOUT) { |
712 | timeout += jiffies; | 713 | timeout += jiffies; |
714 | /* although we prefer not to time out if the server is still | ||
715 | responding - we will time out if the server takes | ||
716 | more than 15 (or 45 or 180) seconds to respond to this request | ||
717 | and has not responded to any request from other threads | ||
718 | on this client within a second (note that it is not worth | ||
719 | grabbing the GlobalMid_Lock and slowing things down in this | ||
720 | wait event to more accurately check the lstrsp field on some | ||
721 | arch since we are already in an error path that will retry */ | ||
713 | wait_event(ses->server->response_q, | 722 | wait_event(ses->server->response_q, |
714 | (!(midQ->midState & MID_REQUEST_SUBMITTED)) || | 723 | (!(midQ->midState & MID_REQUEST_SUBMITTED)) || |
715 | time_after(jiffies, timeout) || | 724 | (time_after(jiffies, timeout) && |
725 | time_after(jiffies, ses->server->lstrp + HZ)) || | ||
716 | ((ses->server->tcpStatus != CifsGood) && | 726 | ((ses->server->tcpStatus != CifsGood) && |
717 | (ses->server->tcpStatus != CifsNew))); | 727 | (ses->server->tcpStatus != CifsNew))); |
718 | } else { | 728 | } else { |