]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iser-target: Add new state ISER_CONN_BOUND to isert_conn
authorJenny Derzhavetz <jennyf@mellanox.com>
Wed, 24 Feb 2016 17:23:59 +0000 (19:23 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sat, 5 Mar 2016 07:35:38 +0000 (23:35 -0800)
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: Jenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/isert/ib_isert.h

index 09ded3c704e50a81e5f17b5c4841ec6816e03fb3..320d3a55249c1f14ecc8c026527ae06d77704fad 100644 (file)
@@ -825,7 +825,7 @@ isert_put_conn(struct isert_conn *isert_conn)
  * @isert_conn: isert connection struct
  *
  * 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).
  * In case the connection state is UP, complete flush as well.
  *
@@ -841,6 +841,7 @@ isert_conn_terminate(struct isert_conn *isert_conn)
        case ISER_CONN_TERMINATING:
                break;
        case ISER_CONN_UP:
+       case ISER_CONN_BOUND:
        case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
                isert_info("Terminating conn %p state %d\n",
                           isert_conn, isert_conn->state);
@@ -2075,7 +2076,8 @@ isert_cq_comp_err(struct isert_conn *isert_conn, struct ib_wc *wc)
                        isert_completion_put(desc, isert_cmd, ib_dev, true);
        } else {
                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);
        }
 }
@@ -3215,6 +3217,7 @@ accept_wait:
 
        conn->context = isert_conn;
        isert_conn->conn = conn;
+       isert_conn->state = ISER_CONN_BOUND;
 
        isert_set_conn_info(np, conn, isert_conn);
 
index 8d50453eef66ce11d3cf321a535be0abe6b16d43..b80ec44fb4e115c10aa44767e2347b5aaaccf554 100644 (file)
@@ -84,6 +84,7 @@ enum iser_ib_op_code {
 enum iser_conn_state {
        ISER_CONN_INIT,
        ISER_CONN_UP,
+       ISER_CONN_BOUND,
        ISER_CONN_FULL_FEATURE,
        ISER_CONN_TERMINATING,
        ISER_CONN_DOWN,