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