Commit b3501f85 authored by Jenny Derzhavetz's avatar Jenny Derzhavetz Committed by Kamal Mostafa

iser-target: Add new state ISER_CONN_BOUND to isert_conn

commit aea92980 upstream.

We need an indication that isert_conn->iscsi_conn binding has
happened so we'll know not to invoke a connection reinstatement
on an unbound connection which will lead to a bogus isert_conn->conn
dereferece.
Signed-off-by: default avatarJenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent da96543b
...@@ -803,7 +803,7 @@ isert_put_conn(struct isert_conn *isert_conn) ...@@ -803,7 +803,7 @@ isert_put_conn(struct isert_conn *isert_conn)
* @isert_conn: isert connection struct * @isert_conn: isert connection struct
* *
* Notes: * Notes:
* In case the connection state is FULL_FEATURE, move state * In case the connection state is BOUND, move state
* to TEMINATING and start teardown sequence (rdma_disconnect). * to TEMINATING and start teardown sequence (rdma_disconnect).
* In case the connection state is UP, complete flush as well. * In case the connection state is UP, complete flush as well.
* *
...@@ -819,6 +819,7 @@ isert_conn_terminate(struct isert_conn *isert_conn) ...@@ -819,6 +819,7 @@ isert_conn_terminate(struct isert_conn *isert_conn)
case ISER_CONN_TERMINATING: case ISER_CONN_TERMINATING:
break; break;
case ISER_CONN_UP: case ISER_CONN_UP:
case ISER_CONN_BOUND:
case ISER_CONN_FULL_FEATURE: /* FALLTHRU */ case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
isert_info("Terminating conn %p state %d\n", isert_info("Terminating conn %p state %d\n",
isert_conn, isert_conn->state); isert_conn, isert_conn->state);
...@@ -2013,7 +2014,8 @@ isert_cq_comp_err(struct isert_conn *isert_conn, struct ib_wc *wc) ...@@ -2013,7 +2014,8 @@ isert_cq_comp_err(struct isert_conn *isert_conn, struct ib_wc *wc)
isert_completion_put(desc, isert_cmd, ib_dev, true); isert_completion_put(desc, isert_cmd, ib_dev, true);
} else { } else {
isert_conn->post_recv_buf_count--; isert_conn->post_recv_buf_count--;
if (!isert_conn->post_recv_buf_count) if (!isert_conn->post_recv_buf_count &&
isert_conn->state >= ISER_CONN_BOUND)
iscsit_cause_connection_reinstatement(isert_conn->conn, 0); iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
} }
} }
...@@ -3192,6 +3194,7 @@ isert_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) ...@@ -3192,6 +3194,7 @@ isert_accept_np(struct iscsi_np *np, struct iscsi_conn *conn)
conn->context = isert_conn; conn->context = isert_conn;
isert_conn->conn = conn; isert_conn->conn = conn;
isert_conn->state = ISER_CONN_BOUND;
max_accept = 0; max_accept = 0;
isert_set_conn_info(np, conn, isert_conn); isert_set_conn_info(np, conn, isert_conn);
......
...@@ -51,6 +51,7 @@ enum iser_ib_op_code { ...@@ -51,6 +51,7 @@ enum iser_ib_op_code {
enum iser_conn_state { enum iser_conn_state {
ISER_CONN_INIT, ISER_CONN_INIT,
ISER_CONN_UP, ISER_CONN_UP,
ISER_CONN_BOUND,
ISER_CONN_FULL_FEATURE, ISER_CONN_FULL_FEATURE,
ISER_CONN_TERMINATING, ISER_CONN_TERMINATING,
ISER_CONN_DOWN, ISER_CONN_DOWN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment