isns: Fix endless loop when pollhup is returned
commit0180ef02dcf755e8ed82adf63100bffec2b6d876
authorMike Christie <michaelc@cs.wisc.edu>
Wed, 1 Sep 2010 04:34:43 +0000 (31 23:34 -0500)
committerMike Christie <michaelc@cs.wisc.edu>
Wed, 1 Sep 2010 04:34:43 +0000 (31 23:34 -0500)
tree5811309d3f87b8c018e623414798e1d4faacee54
parent8393e31e6059facac8f1aa702deb87ba3f2453f4
isns: Fix endless loop when pollhup is returned

From: Mike Christie <mchristi@redhat.com>

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.
utils/open-isns/socket.c