Commit 42dbb05a authored by Steve French's avatar Steve French

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

into stevef95.austin.ibm.com:/home/stevef/bk/linux-2.5cifs
parents a6f63f7a b84d18a6
......@@ -583,7 +583,7 @@ static int cifs_oplock_thread(void * dummyarg)
do {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(39*HZ);
schedule_timeout(1);
spin_lock(&GlobalMid_Lock);
if(list_empty(&GlobalOplock_Q)) {
spin_unlock(&GlobalMid_Lock);
......
......@@ -274,6 +274,7 @@ struct oplock_q_entry {
#define MID_REQUEST_ALLOCATED 1
#define MID_REQUEST_SUBMITTED 2
#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 *next1; /* @z4a */
......
......@@ -84,6 +84,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct list_head *tmp;
struct cifsSesInfo *ses;
struct cifsTconInfo *tcon;
struct mid_q_entry * mid_entry;
if(server->tcpStatus == CifsExiting)
return rc;
......@@ -123,6 +124,23 @@ cifs_reconnect(struct TCP_Server_Info *server)
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))
{
rc = ipv4_connect(&server->sockAddr, &server->ssocket);
......@@ -193,6 +211,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} else if (server->tcpStatus == CifsNeedReconnect) {
cFYI(1,("Reconnecting after server stopped responding"));
cifs_reconnect(server);
cFYI(1,("call to reconnect done"));
csocket = server->ssocket;
continue;
} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
......
......@@ -222,6 +222,9 @@ static int cifs_reopen_file(struct inode *inode, struct file *file)
__u16 netfid;
FILE_ALL_INFO * buf = NULL;
if(inode == NULL)
return -EBADF;
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
......
......@@ -190,6 +190,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
long timeout;
struct mid_q_entry *midQ;
cifs_dead_ses_retry:
midQ = AllocMidQEntry(in_buf, ses);
if (midQ == NULL)
return -EIO;
......@@ -236,8 +237,12 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
be32_to_cpu(midQ->resp_buf->smb_buf_length);
else {
cFYI(1,("No response buffer"));
DeleteMidQEntry(midQ);
if(midQ->midState != MID_RETRY_NEEDED) {
ses->server->tcpStatus = CifsNeedReconnect;
DeleteMidQEntry(midQ);
goto cifs_dead_ses_retry;
}
DeleteMidQEntry(midQ);
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