summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2010-08-31 23:34:43 -0500
committerMike Christie <michaelc@cs.wisc.edu>2010-08-31 23:34:43 -0500
commit0180ef02dcf755e8ed82adf63100bffec2b6d876 (patch)
tree5811309d3f87b8c018e623414798e1d4faacee54 /utils
parent8393e31e6059facac8f1aa702deb87ba3f2453f4 (diff)
downloadopen-iscsi-0180ef02dcf755e8ed82adf63100bffec2b6d876.tar.gz
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.
Diffstat (limited to 'utils')
-rw-r--r--utils/open-isns/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/open-isns/socket.c b/utils/open-isns/socket.c
index baed13c..7a5dfd4 100644
--- a/utils/open-isns/socket.c
+++ b/utils/open-isns/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);