]> git.baikalelectronics.ru Git - kernel.git/commitdiff
[SCSI] iscsi_tcp: fix relogin/shutdown hang
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 31 Mar 2010 19:41:35 +0000 (14:41 -0500)
committerJames Bottomley <James.Bottomley@suse.de>
Sun, 11 Apr 2010 18:28:13 +0000 (13:28 -0500)
When I made this patch:
17555eeb7e15fc1fed8e9567b046db8d6992fa2a
it was to solve a problem where we were already on the waitqueue
becuase a connection problem/logout caused us to be on there
when we were cleaning up the session. If we happen to get
on queue for more normal reasons like their just does not happen
to be any send space at the same time we are closing the connection
we hit a race and get stuck in the wait.

We should not check if the waitqueue is active
because we could race with the network code. If
the network xmit code is just about to enter the
prepare to wait when we check for the waitqueue to
be active then we will miss each other and the
network code will fall into the wait and we will
not run wake_up.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/iscsi_tcp.c

index 0ee725ced51104944b1d5ef56339a7e4fde0578c..02143af7c1af6234a27d416b6e5e8a3df370c057 100644 (file)
@@ -599,7 +599,7 @@ static void iscsi_sw_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
        set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
        write_unlock_bh(&tcp_sw_conn->sock->sk->sk_callback_lock);
 
-       if (sock->sk->sk_sleep && waitqueue_active(sock->sk->sk_sleep)) {
+       if (sock->sk->sk_sleep) {
                sock->sk->sk_err = EIO;
                wake_up_interruptible(sock->sk->sk_sleep);
        }