提交 5426b171 编写于 作者: A Ariel Nahum 提交者: Roland Dreier

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: NAriel Nahum <arieln@mellanox.com>
Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 16df2a26
...@@ -629,9 +629,11 @@ void iser_conn_release(struct iser_conn *iser_conn) ...@@ -629,9 +629,11 @@ void iser_conn_release(struct iser_conn *iser_conn)
mutex_unlock(&ig.connlist_mutex); mutex_unlock(&ig.connlist_mutex);
mutex_lock(&iser_conn->state_mutex); mutex_lock(&iser_conn->state_mutex);
if (iser_conn->state != ISER_CONN_DOWN) if (iser_conn->state != ISER_CONN_DOWN) {
iser_warn("iser conn %p state %d, expected state down.\n", iser_warn("iser conn %p state %d, expected state down.\n",
iser_conn, iser_conn->state); iser_conn, iser_conn->state);
iser_conn->state = ISER_CONN_DOWN;
}
/* /*
* In case we never got to bind stage, we still need to * In case we never got to bind stage, we still need to
* release IB resources (which is safe to call more than once). * 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,20 +869,21 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
break; break;
case RDMA_CM_EVENT_DISCONNECTED: case RDMA_CM_EVENT_DISCONNECTED:
case RDMA_CM_EVENT_ADDR_CHANGE: case RDMA_CM_EVENT_ADDR_CHANGE:
iser_disconnected_handler(cma_id); case RDMA_CM_EVENT_TIMEWAIT_EXIT:
iser_cleanup_handler(cma_id, false);
break; break;
case RDMA_CM_EVENT_DEVICE_REMOVAL: case RDMA_CM_EVENT_DEVICE_REMOVAL:
/* /*
* we *must* destroy the device as we cannot rely * we *must* destroy the device as we cannot rely
* on iscsid to be around to initiate error handling. * on iscsid to be around to initiate error handling.
* also implicitly destroy the cma_id. * also if we are not in state DOWN implicitly destroy
* the cma_id.
*/ */
iser_cleanup_handler(cma_id, true); iser_cleanup_handler(cma_id, true);
iser_conn->ib_conn.cma_id = NULL; if (iser_conn->state != ISER_CONN_DOWN) {
ret = 1; iser_conn->ib_conn.cma_id = NULL;
break; ret = 1;
case RDMA_CM_EVENT_TIMEWAIT_EXIT: }
iser_cleanup_handler(cma_id, false);
break; break;
default: default:
iser_err("Unexpected RDMA CM event (%d)\n", event->event); iser_err("Unexpected RDMA CM event (%d)\n", event->event);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册