Commit 3b726ae2 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Nicholas Bellinger

iser-target: Handle DEVICE_REMOVAL event on network portal listener correctly

In this case the cm_id->context is the isert_np, and the cm_id->qp
is NULL, so use that to distinct the cases.

Since we don't expect any other events on this cm_id we can
just return -1 for explicit termination of the cm_id by the
cma layer.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent f57915cf
...@@ -806,14 +806,25 @@ isert_disconnect_work(struct work_struct *work) ...@@ -806,14 +806,25 @@ isert_disconnect_work(struct work_struct *work)
complete(&isert_conn->conn_wait); complete(&isert_conn->conn_wait);
} }
static void static int
isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
{ {
struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; struct isert_conn *isert_conn;
if (!cma_id->qp) {
struct isert_np *isert_np = cma_id->context;
isert_np->np_cm_id = NULL;
return -1;
}
isert_conn = (struct isert_conn *)cma_id->context;
isert_conn->disconnect = disconnect; isert_conn->disconnect = disconnect;
INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
schedule_work(&isert_conn->conn_logout_work); schedule_work(&isert_conn->conn_logout_work);
return 0;
} }
static int static int
...@@ -828,6 +839,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) ...@@ -828,6 +839,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
switch (event->event) { switch (event->event) {
case RDMA_CM_EVENT_CONNECT_REQUEST: case RDMA_CM_EVENT_CONNECT_REQUEST:
ret = isert_connect_request(cma_id, event); ret = isert_connect_request(cma_id, event);
if (ret)
pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
event->event, ret);
break; break;
case RDMA_CM_EVENT_ESTABLISHED: case RDMA_CM_EVENT_ESTABLISHED:
isert_connected_handler(cma_id); isert_connected_handler(cma_id);
...@@ -837,7 +851,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) ...@@ -837,7 +851,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
disconnect = true; disconnect = true;
case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */
isert_disconnected_handler(cma_id, disconnect); ret = isert_disconnected_handler(cma_id, disconnect);
break; break;
case RDMA_CM_EVENT_CONNECT_ERROR: case RDMA_CM_EVENT_CONNECT_ERROR:
default: default:
...@@ -845,12 +859,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) ...@@ -845,12 +859,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
break; break;
} }
if (ret != 0) {
pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
event->event, ret);
dump_stack();
}
return ret; return ret;
} }
...@@ -3193,7 +3201,8 @@ isert_free_np(struct iscsi_np *np) ...@@ -3193,7 +3201,8 @@ isert_free_np(struct iscsi_np *np)
{ {
struct isert_np *isert_np = (struct isert_np *)np->np_context; struct isert_np *isert_np = (struct isert_np *)np->np_context;
rdma_destroy_id(isert_np->np_cm_id); if (isert_np->np_cm_id)
rdma_destroy_id(isert_np->np_cm_id);
np->np_context = NULL; np->np_context = NULL;
kfree(isert_np); kfree(isert_np);
......
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