From: Mike Christie <[email protected]>

If we are trying to send data, but get a POLLHUP we get
stuck in a endless loop. The problem is that the isns
socket handling for POLLHUP only clears the POLLIN bit, so
when we do this check:

                /* No more input and output means closed&dead */
                if (sock->is_state == ISNS_SOCK_IDLE
                 && !(sock->is_poll_mask & (POLLIN|POLLOUT))) {
                        isns_debug_socket("connection closed by peer,
killing socket\n");
                        isns_net_close(sock, ISNS_SOCK_FAILED);
                }

the POLLOUT bit is still set and we never are able to close the old
socket and reconnect a new one or fail or pass the status to the
caller.

This patch has the pollhup callout clear the POLLOUT bit.

Signed-off-by: Mike Christie <[email protected]>
---
 socket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/socket.c b/socket.c
index baed13c..7a5dfd4 100644
--- a/socket.c
+++ b/socket.c
@@ -805,7 +805,7 @@ isns_net_stream_xmit(isns_socket_t *sock)
 void
 isns_net_stream_hup(isns_socket_t *sock)
 {
-       sock->is_poll_mask &= ~POLLIN;
+       sock->is_poll_mask &= ~(POLLIN|POLLOUT);
        /* POLLHUP while connecting means we failed */
        if (sock->is_state == ISNS_SOCK_CONNECTING)
                isns_net_stream_error(sock, ECONNREFUSED);
-- 
1.7.2.1

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to