diff options
author | Sagi Grimberg <sagig@dev.mellanox.co.il> | 2014-10-28 16:45:03 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-11-03 01:04:48 -0500 |
commit | 3b726ae2de02a406cc91903f80132daee37b6f1b (patch) | |
tree | a340e63312c5b6ea084f92a6199a9b9ed008f8aa /drivers/infiniband | |
parent | f57915cfa5b2b14c1cffa2e83c034f55e3f0e70d (diff) |
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: Sagi Grimberg <sagig@mellanox.com>
Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index ef5b22b3ea83..a6c7b395c61d 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -806,14 +806,25 @@ wake_up: | |||
806 | complete(&isert_conn->conn_wait); | 806 | complete(&isert_conn->conn_wait); |
807 | } | 807 | } |
808 | 808 | ||
809 | static void | 809 | static int |
810 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) | 810 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) |
811 | { | 811 | { |
812 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; | 812 | struct isert_conn *isert_conn; |
813 | |||
814 | if (!cma_id->qp) { | ||
815 | struct isert_np *isert_np = cma_id->context; | ||
816 | |||
817 | isert_np->np_cm_id = NULL; | ||
818 | return -1; | ||
819 | } | ||
820 | |||
821 | isert_conn = (struct isert_conn *)cma_id->context; | ||
813 | 822 | ||
814 | isert_conn->disconnect = disconnect; | 823 | isert_conn->disconnect = disconnect; |
815 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); | 824 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); |
816 | schedule_work(&isert_conn->conn_logout_work); | 825 | schedule_work(&isert_conn->conn_logout_work); |
826 | |||
827 | return 0; | ||
817 | } | 828 | } |
818 | 829 | ||
819 | static int | 830 | static int |
@@ -828,6 +839,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
828 | switch (event->event) { | 839 | switch (event->event) { |
829 | case RDMA_CM_EVENT_CONNECT_REQUEST: | 840 | case RDMA_CM_EVENT_CONNECT_REQUEST: |
830 | ret = isert_connect_request(cma_id, event); | 841 | ret = isert_connect_request(cma_id, event); |
842 | if (ret) | ||
843 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
844 | event->event, ret); | ||
831 | break; | 845 | break; |
832 | case RDMA_CM_EVENT_ESTABLISHED: | 846 | case RDMA_CM_EVENT_ESTABLISHED: |
833 | isert_connected_handler(cma_id); | 847 | isert_connected_handler(cma_id); |
@@ -837,7 +851,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
837 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | 851 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ |
838 | disconnect = true; | 852 | disconnect = true; |
839 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 853 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
840 | isert_disconnected_handler(cma_id, disconnect); | 854 | ret = isert_disconnected_handler(cma_id, disconnect); |
841 | break; | 855 | break; |
842 | case RDMA_CM_EVENT_CONNECT_ERROR: | 856 | case RDMA_CM_EVENT_CONNECT_ERROR: |
843 | default: | 857 | default: |
@@ -845,12 +859,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
845 | break; | 859 | break; |
846 | } | 860 | } |
847 | 861 | ||
848 | if (ret != 0) { | ||
849 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
850 | event->event, ret); | ||
851 | dump_stack(); | ||
852 | } | ||
853 | |||
854 | return ret; | 862 | return ret; |
855 | } | 863 | } |
856 | 864 | ||
@@ -3193,7 +3201,8 @@ isert_free_np(struct iscsi_np *np) | |||
3193 | { | 3201 | { |
3194 | struct isert_np *isert_np = (struct isert_np *)np->np_context; | 3202 | struct isert_np *isert_np = (struct isert_np *)np->np_context; |
3195 | 3203 | ||
3196 | rdma_destroy_id(isert_np->np_cm_id); | 3204 | if (isert_np->np_cm_id) |
3205 | rdma_destroy_id(isert_np->np_cm_id); | ||
3197 | 3206 | ||
3198 | np->np_context = NULL; | 3207 | np->np_context = NULL; |
3199 | kfree(isert_np); | 3208 | kfree(isert_np); |