iscsi/iser-target: Fix isert_conn->state hung shutdown issues
authorNicholas Bellinger <nab@linux-iscsi.org>
Mon, 3 Feb 2014 20:54:39 +0000 (12:54 -0800)
committerJiri Slaby <jslaby@suse.cz>
Sat, 22 Mar 2014 21:01:58 +0000 (22:01 +0100)
commit2f82fa987df6b060241fc760eadf5dd02c51a979
treea1ff3afb8f0baaf97fd9eb22582913dbf8824da5
parente150903c747b642896a2807a4567faa7f002f3a7
iscsi/iser-target: Fix isert_conn->state hung shutdown issues

commit defd884845297fd5690594bfe89656b01f16d87e upstream.

This patch addresses a couple of different hug shutdown issues
related to wait_event() + isert_conn->state.  First, it changes
isert_conn->conn_wait + isert_conn->conn_wait_comp_err from
waitqueues to completions, and sets ISER_CONN_TERMINATING from
within isert_disconnect_work().

Second, it splits isert_free_conn() into isert_wait_conn() that
is called earlier in iscsit_close_connection() to ensure that
all outstanding commands have completed before continuing.

Finally, it breaks isert_cq_comp_err() into seperate TX / RX
related code, and adds logic in isert_cq_rx_comp_err() to wait
for outstanding commands to complete before setting ISER_CONN_DOWN
and calling complete(&isert_conn->conn_wait_comp_err).

Acked-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/isert/ib_isert.h
drivers/target/iscsi/iscsi_target.c
include/target/iscsi/iscsi_transport.h