Commit 388f8f38 authored by Steve French's avatar Steve French

Merge bk://cifs.bkbits.net/linux-2.5cifs

into smfhome.smfdom:/home/stevef/bk/linux-2.5cifs
parents 287c92db 7c340734
...@@ -233,12 +233,14 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -233,12 +233,14 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
smb negprot error in which case reconnecting here is smb negprot error in which case reconnecting here is
not going to help - return error to mount */ not going to help - return error to mount */
server->tcpStatus = CifsExiting; server->tcpStatus = CifsExiting;
wake_up(&server->response_q);
break; break;
} }
cFYI(1,("Reconnecting after unexpected rcvmsg error ")); cFYI(1,("Reconnecting after unexpected rcvmsg error "));
cifs_reconnect(server); cifs_reconnect(server);
csocket = server->ssocket; csocket = server->ssocket;
wake_up(&server->response_q);
continue; continue;
} }
...@@ -258,11 +260,30 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -258,11 +260,30 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} else if ((temp[0] == (char) 0x83) } else if ((temp[0] == (char) 0x83)
&& (length == 5)) { && (length == 5)) {
/* we get this from Windows 98 instead of error on SMB negprot response */ /* we get this from Windows 98 instead of error on SMB negprot response */
cERROR(1, cFYI(1,("Negative RFC 1002 Session Response Error 0x%x)",temp[4]));
("Negative RFC 1002 Session response. Error = 0x%x", if(server->tcpStatus == CifsNew) {
temp[4])); /* if nack on negprot (rather than
ret of smb negprot error) reconnecting
not going to help, ret error to mount */
server->tcpStatus = CifsExiting;
/* wake up thread doing negprot */
wake_up(&server->response_q);
break; break;
} else {
/* give server a second to
clean up before reconnect attempt */
schedule_timeout(HZ);
/* always try 445 first on reconnect
since we get NACK on some if we ever
connected to port 139 (the NACK is
since we do not begin with RFC1001
session initialize frame) */
server->addr.sockAddr.sin_port = CIFS_PORT;
cifs_reconnect(server);
csocket = server->ssocket;
wake_up(&server->response_q);
continue;
}
} else if (temp[0] != (char) 0) { } else if (temp[0] != (char) 0) {
cERROR(1, cERROR(1,
("Unknown RFC 1001 frame not 0x00 nor 0x85")); ("Unknown RFC 1001 frame not 0x00 nor 0x85"));
...@@ -823,6 +844,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket) ...@@ -823,6 +844,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
{ {
int rc = 0; int rc = 0;
int connected = 0; int connected = 0;
unsigned short int orig_port = 0;
if(*csocket == NULL) { if(*csocket == NULL) {
rc = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket); rc = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, csocket);
...@@ -847,6 +869,10 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket) ...@@ -847,6 +869,10 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
} }
if(!connected) { if(!connected) {
/* save original port so we can retry user specified port
later if fall back ports fail this time */
orig_port = psin_server->sin_port;
/* do not retry on the same port we just failed on */ /* do not retry on the same port we just failed on */
if(psin_server->sin_port != htons(CIFS_PORT)) { if(psin_server->sin_port != htons(CIFS_PORT)) {
psin_server->sin_port = htons(CIFS_PORT); psin_server->sin_port = htons(CIFS_PORT);
...@@ -869,6 +895,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket) ...@@ -869,6 +895,8 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket)
/* give up here - unless we want to retry on different /* give up here - unless we want to retry on different
protocol families some day */ protocol families some day */
if (!connected) { if (!connected) {
if(orig_port)
psin_server->sin_port = orig_port;
cFYI(1,("Error %d connecting to server via ipv4",rc)); cFYI(1,("Error %d connecting to server via ipv4",rc));
sock_release(*csocket); sock_release(*csocket);
*csocket = NULL; *csocket = NULL;
......
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