Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269945
b: refs/heads/master
c: ba749e6
h: refs/heads/master
i:
  269943: 387919e
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Oct 13, 2011
1 parent f1c8ebe commit a072968
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e831e6cf3acb058d898411367a582deef80e32f8
refs/heads/master: ba749e6d5227de22e442c6088cc7dc1f0c5c68bf
33 changes: 22 additions & 11 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,23 @@ allocate_buffers(char **bigbuf, char **smallbuf, unsigned int size,
return true;
}

static bool
server_unresponsive(struct TCP_Server_Info *server)
{
if (echo_retries > 0 && server->tcpStatus == CifsGood &&
time_after(jiffies, server->lstrp +
(echo_retries * SMB_ECHO_INTERVAL))) {
cERROR(1, "Server %s has not responded in %d seconds. "
"Reconnecting...", server->hostname,
(echo_retries * SMB_ECHO_INTERVAL / HZ));
cifs_reconnect(server);
wake_up(&server->response_q);
return true;
}

return false;
}

static int
read_from_socket(struct TCP_Server_Info *server,
struct kvec *iov, unsigned int to_read,
Expand All @@ -372,6 +389,11 @@ read_from_socket(struct TCP_Server_Info *server,
smb_msg.msg_controllen = 0;

for (total_read = 0; total_read < to_read; total_read += length) {
if (server_unresponsive(server)) {
rc = 1;
break;
}

length = kernel_recvmsg(server->ssocket, &smb_msg, iov, 1,
to_read - total_read, 0);
if (server->tcpStatus == CifsExiting) {
Expand Down Expand Up @@ -669,17 +691,6 @@ cifs_demultiplex_thread(void *p)
pdu_length = 4; /* enough to get RFC1001 header */

incomplete_rcv:
if (echo_retries > 0 && server->tcpStatus == CifsGood &&
time_after(jiffies, server->lstrp +
(echo_retries * SMB_ECHO_INTERVAL))) {
cERROR(1, "Server %s has not responded in %d seconds. "
"Reconnecting...", server->hostname,
(echo_retries * SMB_ECHO_INTERVAL / HZ));
cifs_reconnect(server);
wake_up(&server->response_q);
continue;
}

rc = read_from_socket(server, &iov, pdu_length,
&total_read, true /* header read */);
if (rc == 3)
Expand Down

0 comments on commit a072968

Please sign in to comment.