Commit 00f6a975 authored by Steve French's avatar Steve French

fix timeout on close operation when pending signal

parent afba7f60
......@@ -2,7 +2,8 @@ Version 1.10
------------
Fix reconnection (and certain failed mounts) to properly wake up the
blocked users thread so it does not seem hung (in some cases was blocked
until the cifs receive timeout expired).
until the cifs receive timeout expired). Fix spurious error logging
to kernel log when application with open network files killed.
Version 1.09
------------
......
......@@ -653,6 +653,7 @@ static int cifs_oplock_thread(void * dummyarg)
spin_lock(&GlobalMid_Lock);
if(list_empty(&GlobalOplock_Q)) {
spin_unlock(&GlobalMid_Lock);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(39*HZ);
} else {
oplock_item = list_entry(GlobalOplock_Q.next,
......
......@@ -822,8 +822,11 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
if(rc!=-EINTR) {
/* EINTR is expected when user ctl-c to kill app */
cERROR(1, ("Send error in Close = %d", rc));
}
}
if (pSMB)
cifs_buf_release(pSMB);
......
......@@ -223,6 +223,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
csocket = server->ssocket;
continue;
} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1); /* minimum sleep to prevent looping
allowing socket to clear and app threads to set
tcpStatus CifsNeedReconnect if server hung */
......@@ -277,6 +278,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} else {
/* give server a second to
clean up before reconnect attempt */
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
/* always try 445 first on reconnect
since we get NACK on some if we ever
......
......@@ -151,6 +151,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
set_fs(get_ds());
rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
while((rc == -ENOSPC) || (rc == -EAGAIN)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/2);
rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
}
......@@ -233,16 +234,23 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
timeout = 15 * HZ;
/* wait for 15 seconds or until woken up due to response arriving or
due to last connection to this server being unmounted */
if (signal_pending(current)) {
/* if signal pending do not hold up user for full smb timeout
but we still give response a change to complete */
if(midQ->midState & MID_REQUEST_SUBMITTED) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(HZ);
}
} else { /* use normal timeout */
timeout = wait_event_interruptible_timeout(ses->server->response_q,
(midQ->midState & MID_RESPONSE_RECEIVED) ||
((ses->server->tcpStatus != CifsGood) &&
(ses->server->tcpStatus != CifsNew)),
timeout);
}
if (signal_pending(current)) {
cFYI(1, ("CIFS: caught signal"));
DeleteMidQEntry(midQ);
return -EINTR;
return -EINTR; /* BB are we supposed to return -ERESTARTSYS ? */
} else { /* BB spinlock protect this against races with demux thread */
spin_lock(&GlobalMid_Lock);
if (midQ->resp_buf) {
......
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