Commit 3ff276de authored by Steve French's avatar Steve French Committed by Steve French

fixes to not prematurely exit demultiplex captive thread

parent a14a4254
...@@ -196,32 +196,17 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -196,32 +196,17 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
csocket = server->ssocket; csocket = server->ssocket;
continue; continue;
} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
cFYI(0,("ERESTARTSYS returned from sock_recvmsg"));
schedule_timeout(1); /* minimum sleep to prevent looping schedule_timeout(1); /* minimum sleep to prevent looping
allowing socket to clear and app threads to set allowing socket to clear and app threads to set
tcpStatus CifsNeedReconnect if server hung */ tcpStatus CifsNeedReconnect if server hung */
continue; continue;
} else if (length < 0) { } else if (length <= 0) {
if (length == -ECONNRESET) { cFYI(1,("Reconnecting after unexpected rcvmsg error "));
cERROR(1, ("Connection reset by peer "));
cifs_reconnect(server);
csocket = server->ssocket;
} else {
cERROR(1,("Unexpected error on sock_recvmsg(peek) = %d",
length)); /* there may be other non-fatal
errors that the tcp stack can return
to kernel that are not documented yet
and that are not checked above. */
cifs_reconnect(server);
csocket = server->ssocket;
}
continue;
} else if (length == 0) {
cFYI(1,("Zero length peek received - dead session?"));
cifs_reconnect(server); cifs_reconnect(server);
csocket = server->ssocket; csocket = server->ssocket;
continue; continue;
} }
pdu_length = 4 + ntohl(smb_buffer->smb_buf_length); pdu_length = 4 + ntohl(smb_buffer->smb_buf_length);
cFYI(1, ("Peek length rcvd: %d with smb length: %d", length, pdu_length)); cFYI(1, ("Peek length rcvd: %d with smb length: %d", length, pdu_length));
...@@ -245,7 +230,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -245,7 +230,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cERROR(1, cERROR(1,
("Unknown RFC 1001 frame received not 0x00 nor 0x85")); ("Unknown RFC 1001 frame received not 0x00 nor 0x85"));
cifs_dump_mem(" Received Data is: ", temp, length); cifs_dump_mem(" Received Data is: ", temp, length);
break; cifs_reconnect(server);
csocket = server->ssocket;
continue;
} else { } else {
if ((length != sizeof (struct smb_hdr) - 1) if ((length != sizeof (struct smb_hdr) - 1)
|| (pdu_length > || (pdu_length >
...@@ -259,11 +246,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -259,11 +246,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
("Invalid size or format for SMB found with length %d and pdu_lenght %d", ("Invalid size or format for SMB found with length %d and pdu_lenght %d",
length, pdu_length)); length, pdu_length));
cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr));
/* BB fix by finding next smb signature - and reading off data until next smb ? BB */ /* could we fix this network corruption by finding next
smb header (instead of killing the session) and
/* BB add reconnect here */ restart reading from next valid SMB found? */
cifs_reconnect(server);
break; csocket = server->ssocket;
continue;
} else { /* length ok */ } else { /* length ok */
length = 0; length = 0;
...@@ -277,9 +265,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -277,9 +265,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cERROR(1, cERROR(1,
("Zero length receive when expecting %d ", ("Zero length receive when expecting %d ",
pdu_length - total_read)); pdu_length - total_read));
/* BB add reconnect here */ cifs_reconnect(server);
break; csocket = server->ssocket;
} continue;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment