]> git.neil.brown.name Git - history.git/commitdiff
fix timeout on close operation when pending signal
authorSteve French <stevef@stevef95.austin.ibm.com>
Thu, 22 Apr 2004 17:55:12 +0000 (12:55 -0500)
committerSteve French <stevef@stevef95.austin.ibm.com>
Thu, 22 Apr 2004 17:55:12 +0000 (12:55 -0500)
fs/cifs/CHANGES
fs/cifs/cifsfs.c
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/transport.c

index 8da6b97dd85d5e049b2077ce645d39caa71b434f..9b0ce960edc7f4b249e19b1f0da75f63d2f02add 100644 (file)
@@ -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
 ------------
index e3e00f4d519c2bf0ece1ad96806241f6135bc861..57bb58ff68faca983d176061f9cce07dbd3efbf5 100644 (file)
@@ -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, 
index ecca4db3f83f034bcb0b9e4a4ecde69e69bf5e37..e8134625ea4a290572c806b4876e2cb87fbafcb7 100644 (file)
@@ -822,7 +822,10 @@ 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) {
-               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)
                cifs_buf_release(pSMB);
index b281cc51c7084db62011b0dd12c4eb8e6950a751..ec822136376cb04b010801ae7c1b014fa5ac3a33 100644 (file)
@@ -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
index 4f20bbed31aa304b0fb41fc7f7f9b6a54dbbdce9..8ce13bf52ee36758a35d4e0786f7a1bcf0a33be9 100644 (file)
@@ -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 */
-
-       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"));
+               /* 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);
-               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) {