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

fix to not retime out the same session twice since it can invalidate the newly...

fix to not retime out the same session twice since it can invalidate the newly reestablished session unnecessarily
parent c85c39e7
...@@ -583,7 +583,7 @@ static int cifs_oplock_thread(void * dummyarg) ...@@ -583,7 +583,7 @@ static int cifs_oplock_thread(void * dummyarg)
do { do {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(39*HZ); schedule_timeout(1);
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
if(list_empty(&GlobalOplock_Q)) { if(list_empty(&GlobalOplock_Q)) {
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
......
...@@ -274,6 +274,7 @@ struct oplock_q_entry { ...@@ -274,6 +274,7 @@ struct oplock_q_entry {
#define MID_REQUEST_ALLOCATED 1 #define MID_REQUEST_ALLOCATED 1
#define MID_REQUEST_SUBMITTED 2 #define MID_REQUEST_SUBMITTED 2
#define MID_RESPONSE_RECEIVED 4 #define MID_RESPONSE_RECEIVED 4
#define MID_RETRY_NEEDED 8 /* session closed while this request out */
struct servers_not_supported { /* @z4a */ struct servers_not_supported { /* @z4a */
struct servers_not_supported *next1; /* @z4a */ struct servers_not_supported *next1; /* @z4a */
......
...@@ -84,6 +84,7 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -84,6 +84,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct list_head *tmp; struct list_head *tmp;
struct cifsSesInfo *ses; struct cifsSesInfo *ses;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
struct mid_q_entry * mid_entry;
if(server->tcpStatus == CifsExiting) if(server->tcpStatus == CifsExiting)
return rc; return rc;
...@@ -123,6 +124,23 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -123,6 +124,23 @@ cifs_reconnect(struct TCP_Server_Info *server)
server->ssocket = NULL; server->ssocket = NULL;
} }
spin_lock(&GlobalMid_Lock);
list_for_each(tmp, &server->pending_mid_q) {
mid_entry = list_entry(tmp, struct
mid_q_entry,
qhead);
if(mid_entry) {
if(mid_entry->midState == MID_REQUEST_SUBMITTED) {
/* Mark other intransit requests as needing retry so
we do not immediately mark the session bad again
(ie after we reconnect below) as they timeout too */
mid_entry->midState = MID_RETRY_NEEDED;
}
}
}
spin_unlock(&GlobalMid_Lock);
while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood)) while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood))
{ {
rc = ipv4_connect(&server->sockAddr, &server->ssocket); rc = ipv4_connect(&server->sockAddr, &server->ssocket);
...@@ -193,6 +211,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -193,6 +211,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} else 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);
cFYI(1,("call to reconnect done"));
csocket = server->ssocket; csocket = server->ssocket;
continue; continue;
} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
......
...@@ -222,6 +222,9 @@ static int cifs_reopen_file(struct inode *inode, struct file *file) ...@@ -222,6 +222,9 @@ static int cifs_reopen_file(struct inode *inode, struct file *file)
__u16 netfid; __u16 netfid;
FILE_ALL_INFO * buf = NULL; FILE_ALL_INFO * buf = NULL;
if(inode == NULL)
return -EBADF;
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
...@@ -339,10 +342,10 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo) ...@@ -339,10 +342,10 @@ int reopen_files(struct cifsTconInfo * pTcon, struct nls_table * nlsinfo)
rc = cifs_reopen_file(file->f_dentry->d_inode,file); rc = cifs_reopen_file(file->f_dentry->d_inode,file);
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
if(file->private_data == NULL) { if(file->private_data == NULL) {
tmp = invalid_file_list.next; tmp = invalid_file_list.next;
tmp1 = tmp->next; tmp1 = tmp->next;
continue; continue;
} }
list_move(&open_file->tlist,&pTcon->openFileList); list_move(&open_file->tlist,&pTcon->openFileList);
if(rc) { if(rc) {
......
...@@ -190,6 +190,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -190,6 +190,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
long timeout; long timeout;
struct mid_q_entry *midQ; struct mid_q_entry *midQ;
cifs_dead_ses_retry:
midQ = AllocMidQEntry(in_buf, ses); midQ = AllocMidQEntry(in_buf, ses);
if (midQ == NULL) if (midQ == NULL)
return -EIO; return -EIO;
...@@ -201,10 +202,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -201,10 +202,10 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
return -EIO; return -EIO;
} }
if (in_buf->smb_buf_length > 12) if (in_buf->smb_buf_length > 12)
in_buf->Flags2 = cpu_to_le16(in_buf->Flags2); in_buf->Flags2 = cpu_to_le16(in_buf->Flags2);
rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number); rc = cifs_sign_smb(in_buf, ses, &midQ->sequence_number);
midQ->midState = MID_REQUEST_SUBMITTED; midQ->midState = MID_REQUEST_SUBMITTED;
rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
...@@ -236,8 +237,12 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -236,8 +237,12 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
be32_to_cpu(midQ->resp_buf->smb_buf_length); be32_to_cpu(midQ->resp_buf->smb_buf_length);
else { else {
cFYI(1,("No response buffer")); cFYI(1,("No response buffer"));
if(midQ->midState != MID_RETRY_NEEDED) {
ses->server->tcpStatus = CifsNeedReconnect;
DeleteMidQEntry(midQ);
goto cifs_dead_ses_retry;
}
DeleteMidQEntry(midQ); DeleteMidQEntry(midQ);
ses->server->tcpStatus = CifsNeedReconnect;
return -EIO; return -EIO;
} }
} }
......
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