Commit aa243ba4 authored by Steve French's avatar Steve French Committed by Steve French

fix loop on mount failure of session setup

parent 56b4933b
Version 0.94 Version 0.94
------------ ------------
Fix to list processing in reopen_files. Fix reconnection when server hung Fix to list processing in reopen_files. Fix reconnection when server hung
but tcpip session still alive. but tcpip session still alive. Set proper timeout on socket read.
Version 0.93 Version 0.93
------------ ------------
......
...@@ -84,9 +84,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, ...@@ -84,9 +84,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
length = length =
sprintf(buf, sprintf(buf,
"\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x", "\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\tTCP session status: %d",
i, ses->serverName, ses->serverDomain, atomic_read(&ses->inUse), i, ses->serverName, ses->serverDomain, atomic_read(&ses->inUse),
ses->serverOS, ses->serverNOS, ses->capabilities); ses->serverOS, ses->serverNOS, ses->capabilities,ses->status,ses->server->tcpStatus);
buf += length; buf += length;
if(ses->server) if(ses->server)
buf += sprintf(buf, "\n\tLocal Users To Same Server: %d SecMode: 0x%x", buf += sprintf(buf, "\n\tLocal Users To Same Server: %d SecMode: 0x%x",
...@@ -106,13 +106,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, ...@@ -106,13 +106,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
length = length =
sprintf(buf, sprintf(buf,
"\n%d) %s Uses: %d on FS: %s with characteristics: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d", "\n%d) %s Uses: %d on FS: %s with characteristics: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d Status: %d",
i, tcon->treeName, i, tcon->treeName,
atomic_read(&tcon->useCount), atomic_read(&tcon->useCount),
tcon->nativeFileSystem, tcon->nativeFileSystem,
tcon->fsDevInfo.DeviceCharacteristics, tcon->fsDevInfo.DeviceCharacteristics,
tcon->fsAttrInfo.Attributes, tcon->fsAttrInfo.Attributes,
tcon->fsAttrInfo.MaxPathNameComponentLength); tcon->fsAttrInfo.MaxPathNameComponentLength,tcon->tidStatus);
buf += length; buf += length;
if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_DISK) if (tcon->fsDevInfo.DeviceType == FILE_DEVICE_DISK)
length = sprintf(buf, " type: DISK "); length = sprintf(buf, " type: DISK ");
......
...@@ -822,7 +822,6 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, ...@@ -822,7 +822,6 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
} else { } else {
len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage); len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage);
} }
cFYI(1,("len of str: %d", len_of_str)); /* BB removeme BB */
rename_info->target_name_len = cpu_to_le32(2 * len_of_str); rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
pSMB->DataCount = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; pSMB->DataCount = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
pSMB->ByteCount += pSMB->DataCount; pSMB->ByteCount += pSMB->DataCount;
......
...@@ -85,6 +85,8 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -85,6 +85,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct cifsSesInfo *ses; struct cifsSesInfo *ses;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
if(server->tcpStatus == CifsExiting)
return rc;
server->tcpStatus = CifsNeedReconnect; server->tcpStatus = CifsNeedReconnect;
server->maxBuf = 0; server->maxBuf = 0;
...@@ -180,17 +182,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -180,17 +182,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
smb_msg.msg_control = NULL; smb_msg.msg_control = NULL;
smb_msg.msg_controllen = 0; smb_msg.msg_controllen = 0;
cFYI(1,("about to rcv csocket %p tcpStatus %d",csocket,server->tcpStatus)); /* BB removeme BB */
length = length =
sock_recvmsg(csocket, &smb_msg, sock_recvmsg(csocket, &smb_msg,
sizeof (struct smb_hdr) - sizeof (struct smb_hdr) -
1 /* RFC1001 header and SMB header */ , 1 /* RFC1001 header and SMB header */ ,
MSG_PEEK /* flags see socket.h */ ); MSG_PEEK /* flags see socket.h */ );
cFYI(1,("rcv csocket %p with rc 0x%x smb len of 0x%x tcpStatus %d",csocket,length,ntohl(smb_buffer->smb_buf_length),server->tcpStatus)); /* BB removeme BB */ if(server->tcpStatus == CifsExiting) {
break;
if (server->tcpStatus == CifsNeedReconnect) { } else if (server->tcpStatus == CifsNeedReconnect) {
cFYI(1,("Reconnecting after server stopped responding")); cFYI(1,("Reconnecting after server stopped responding"));
cifs_reconnect(server); cifs_reconnect(server);
csocket = server->ssocket; csocket = server->ssocket;
...@@ -271,12 +271,8 @@ cFYI(1,("rcv csocket %p with rc 0x%x smb len of 0x%x tcpStatus %d",csocket,lengt ...@@ -271,12 +271,8 @@ cFYI(1,("rcv csocket %p with rc 0x%x smb len of 0x%x tcpStatus %d",csocket,lengt
iov.iov_len = pdu_length; iov.iov_len = pdu_length;
for (total_read = 0; total_read < pdu_length; total_read += length) { for (total_read = 0; total_read < pdu_length; total_read += length) {
/* Should improve check for buffer overflow with bad pdu_length */ /* Should improve check for buffer overflow with bad pdu_length */
/* iov.iov_base = smb_buffer+total_read;
iov.iov_len = pdu_length-total_read; */
length = sock_recvmsg(csocket, &smb_msg, length = sock_recvmsg(csocket, &smb_msg,
pdu_length - total_read, 0); pdu_length - total_read, 0);
/* cERROR(1,("For iovlen %d Length received: %d with total read %d",
iov.iov_len, length,total_read)); */
if (length == 0) { if (length == 0) {
cERROR(1, cERROR(1,
("Zero length receive when expecting %d ", ("Zero length receive when expecting %d ",
...@@ -1067,6 +1063,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -1067,6 +1063,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* on error free sesinfo and tcon struct if needed */ /* on error free sesinfo and tcon struct if needed */
if (rc) { if (rc) {
if(atomic_read(&srvTcp->socketUseCount) == 0)
srvTcp->tcpStatus = CifsExiting;
/* If find_unc succeeded then rc == 0 so we can not end */ /* If find_unc succeeded then rc == 0 so we can not end */
if (tcon) /* up here accidently freeing someone elses tcon struct */ if (tcon) /* up here accidently freeing someone elses tcon struct */
tconInfoFree(tcon); tconInfoFree(tcon);
......
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