diff options
author | Ariel Nahum <arieln@mellanox.com> | 2014-12-07 09:09:54 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-12-15 21:11:44 -0500 |
commit | 5426b1711fd006cb0574a2a24bf738cc38d5220d (patch) | |
tree | 0f409edd9037a1528a81b0d741faa60c23c283cb | |
parent | 16df2a26fb3efb52f066098cdbd0f81c8378d861 (diff) |
IB/iser: Collapse cleanup and disconnect handlers
No real need to wait for TIMEWAIT_EXIT before we destroy the RDMA
resources (also TIMEAWAIT_EXIT is not guarenteed to always arrive). As
for the cma_id, only destroy it if the state is not DOWN where in this
case, conn_release is already running and we don't want to compete.
Signed-off-by: Ariel Nahum <arieln@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/ulp/iser/iser_verbs.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index cd4acc5d94f1..6a2a91c7cdb7 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -629,9 +629,11 @@ void iser_conn_release(struct iser_conn *iser_conn) | |||
629 | mutex_unlock(&ig.connlist_mutex); | 629 | mutex_unlock(&ig.connlist_mutex); |
630 | 630 | ||
631 | mutex_lock(&iser_conn->state_mutex); | 631 | mutex_lock(&iser_conn->state_mutex); |
632 | if (iser_conn->state != ISER_CONN_DOWN) | 632 | if (iser_conn->state != ISER_CONN_DOWN) { |
633 | iser_warn("iser conn %p state %d, expected state down.\n", | 633 | iser_warn("iser conn %p state %d, expected state down.\n", |
634 | iser_conn, iser_conn->state); | 634 | iser_conn, iser_conn->state); |
635 | iser_conn->state = ISER_CONN_DOWN; | ||
636 | } | ||
635 | /* | 637 | /* |
636 | * In case we never got to bind stage, we still need to | 638 | * In case we never got to bind stage, we still need to |
637 | * release IB resources (which is safe to call more than once). | 639 | * release IB resources (which is safe to call more than once). |
@@ -867,20 +869,21 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve | |||
867 | break; | 869 | break; |
868 | case RDMA_CM_EVENT_DISCONNECTED: | 870 | case RDMA_CM_EVENT_DISCONNECTED: |
869 | case RDMA_CM_EVENT_ADDR_CHANGE: | 871 | case RDMA_CM_EVENT_ADDR_CHANGE: |
870 | iser_disconnected_handler(cma_id); | 872 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: |
873 | iser_cleanup_handler(cma_id, false); | ||
871 | break; | 874 | break; |
872 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | 875 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
873 | /* | 876 | /* |
874 | * we *must* destroy the device as we cannot rely | 877 | * we *must* destroy the device as we cannot rely |
875 | * on iscsid to be around to initiate error handling. | 878 | * on iscsid to be around to initiate error handling. |
876 | * also implicitly destroy the cma_id. | 879 | * also if we are not in state DOWN implicitly destroy |
880 | * the cma_id. | ||
877 | */ | 881 | */ |
878 | iser_cleanup_handler(cma_id, true); | 882 | iser_cleanup_handler(cma_id, true); |
879 | iser_conn->ib_conn.cma_id = NULL; | 883 | if (iser_conn->state != ISER_CONN_DOWN) { |
880 | ret = 1; | 884 | iser_conn->ib_conn.cma_id = NULL; |
881 | break; | 885 | ret = 1; |
882 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: | 886 | } |
883 | iser_cleanup_handler(cma_id, false); | ||
884 | break; | 887 | break; |
885 | default: | 888 | default: |
886 | iser_err("Unexpected RDMA CM event (%d)\n", event->event); | 889 | iser_err("Unexpected RDMA CM event (%d)\n", event->event); |