IB/iser: Unbind at conn_stop stage
authorAriel Nahum <arieln@mellanox.com>
Wed, 1 Oct 2014 11:02:03 +0000 (14:02 +0300)
committerRoland Dreier <roland@purestorage.com>
Thu, 9 Oct 2014 07:06:06 +0000 (00:06 -0700)
Previously we didn't need to unbind the iser_conn and iscsi_conn since
we always relied on iscsi daemon to teardown the connection and never
let it finish before we cleanup all that is needed in iser.  This is
not the case anymore (for DEVICE_REMOVAL event).  So avoid any possible
chance we cause iscsi_conn dereference after iscsi_conn was freed.

We also call iser_conn_terminate (safe to call multiple times) just
for the corner case of iscsi daemon stopping an old connection before
invoking endpoint removal (might happen if it was violently killed).

Notice we are unbinding under a lock - which is required.

Signed-off-by: Ariel Nahum <arieln@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/iser/iscsi_iser.c

index db83530184f81ae676a0beb8a053e1ee7dc07858..7298e696c6cf9a7c5df105828b23a8041029e607 100644 (file)
@@ -414,8 +414,15 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
         * might have only partially setup the connection.
         */
        if (iser_conn) {
+               mutex_lock(&iser_conn->state_mutex);
+               iser_conn_terminate(iser_conn);
+
+               /* unbind */
+               iser_conn->iscsi_conn = NULL;
                conn->dd_data = NULL;
+
                complete(&iser_conn->stop_completion);
+               mutex_unlock(&iser_conn->state_mutex);
        }
 }
 
This page took 0.025643 seconds and 5 git commands to generate.