[linux-cifs-client] Timeout waaay too long
Daniel K
dkar at gmx.de
Sun Feb 26 18:03:34 GMT 2006
Hi,
I once tried to reduce the hard coded time out values via a patch:
***begin***
--- a/fs/cifs/connect.c 2006-02-15 18:31:49.000000000 +0100
+++ b/fs/cifs/connect.c 2006-02-15 18:29:09.000000000 +0100
@@ -1433,7 +1433,7 @@
user space buffer */
cFYI(1,("sndbuf %d rcvbuf %d rcvtimeo
0x%lx",(*csocket)->sk->sk_sndbuf,
(*csocket)->sk->sk_rcvbuf, (*csocket)->sk->sk_rcvtimeo));
- (*csocket)->sk->sk_rcvtimeo = 7 * HZ;
+ (*csocket)->sk->sk_rcvtimeo = 2 * HZ;
/* make the bufsizes depend on wsize/rsize and max requests */
if((*csocket)->sk->sk_sndbuf < (200 * 1024))
(*csocket)->sk->sk_sndbuf = 200 * 1024;
@@ -1552,7 +1552,7 @@
/* Eventually check for other socket options to change from
the default. sock_setsockopt not used because it expects
user space buffer */
- (*csocket)->sk->sk_rcvtimeo = 7 * HZ;
+ (*csocket)->sk->sk_rcvtimeo = 2 * HZ;
return rc;
}
--- a/fs/cifs/transport.c 2006-02-15 18:31:49.000000000 +0100
+++ b/fs/cifs/transport.c 2006-02-15 18:29:09.000000000 +0100
@@ -426,7 +426,7 @@
else if (long_op > 2) {
timeout = MAX_SCHEDULE_TIMEOUT;
} else
- timeout = 15 * HZ;
+ timeout = 3 * HZ;
/* wait for 15 seconds or until woken up due to response arriving or
due to last connection to this server being unmounted */
if (signal_pending(current)) {
@@ -437,12 +437,10 @@
/* No user interrupts in wait - wreaks havoc with performance */
if(timeout != MAX_SCHEDULE_TIMEOUT) {
- timeout += jiffies;
- wait_event(ses->server->response_q,
- (!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
- time_after(jiffies, timeout) ||
+ wait_event_interruptible_timeout(ses->server->response_q,
+ (!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
((ses->server->tcpStatus != CifsGood) &&
- (ses->server->tcpStatus != CifsNew)));
+ (ses->server->tcpStatus != CifsNew)), timeout);
} else {
wait_event(ses->server->response_q,
(!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
@@ -693,7 +691,7 @@
else if (long_op > 2) {
timeout = MAX_SCHEDULE_TIMEOUT;
} else
- timeout = 15 * HZ;
+ timeout = 3 * HZ;
/* wait for 15 seconds or until woken up due to response arriving or
due to last connection to this server being unmounted */
if (signal_pending(current)) {
@@ -704,12 +702,10 @@
/* No user interrupts in wait - wreaks havoc with performance */
if(timeout != MAX_SCHEDULE_TIMEOUT) {
- timeout += jiffies;
- wait_event(ses->server->response_q,
- (!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
- time_after(jiffies, timeout) ||
+ wait_event_interruptible_timeout(ses->server->response_q,
+ (!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
((ses->server->tcpStatus != CifsGood) &&
- (ses->server->tcpStatus != CifsNew)));
+ (ses->server->tcpStatus != CifsNew)), timeout);
} else {
wait_event(ses->server->response_q,
(!(midQ->midState & MID_REQUEST_SUBMITTED)) ||
--- a/fs/cifs/cifssmb.c 2006-02-15 21:44:14.000000000 +0100
+++ b/fs/cifs/cifssmb.c 2006-02-15 18:29:09.000000000 +0100
@@ -111,7 +111,7 @@
timeout which is 7 seconds */
while(tcon->ses->server->tcpStatus == CifsNeedReconnect) {
wait_event_interruptible_timeout(tcon->ses->server->response_q,
- (tcon->ses->server->tcpStatus == CifsGood), 10 * HZ);
+ (tcon->ses->server->tcpStatus == CifsGood), 3 * HZ);
if(tcon->ses->server->tcpStatus == CifsNeedReconnect) {
/* on "soft" mounts we wait once */
if((tcon->retry == FALSE) ||
@@ -221,7 +221,7 @@
timeout which is 7 seconds */
while(tcon->ses->server->tcpStatus == CifsNeedReconnect) {
wait_event_interruptible_timeout(tcon->ses->server->response_q,
- (tcon->ses->server->tcpStatus == CifsGood), 10 * HZ);
+ (tcon->ses->server->tcpStatus == CifsGood), 3 * HZ);
if(tcon->ses->server->tcpStatus ==
CifsNeedReconnect) {
/* on "soft" mounts we wait once */
***end***
But I'm not an expert either, so anyone who has a better understanding
of what he's doing maybe could post some ideas. Another approach:
Perhaps it is possible to check whether the server is online by simply
pinging it prior to any access. I mean, in a LAN servers normally
respond within just a few milliseconds, so even an extremely short time
out would do the trick and save a lot of trouble.
I am sure, with the feature added to an upcoming version of CIFS, it
would get a far superior advantage over NFS and SMB.
Best regards,
Daniel
More information about the linux-cifs-client
mailing list