From 99a938f18817fea0c1df3a3f8ea5ced07afb1dba Mon Sep 17 00:00:00 2001 From: Serguei Smirnov Date: Thu, 8 Sep 2022 15:27:12 -0700 Subject: [PATCH] LU-15885 o2iblnd: fix handling of RDMA_CM_EVENT_UNREACHABLE RDMA_CM_EVENT_UNREACHABLE may be received not only when connection is being connected, but also when it is being closed. Fix handing of this event accordingly. Lustre-change: https://review.whamcloud.com/48492 Lustre-commit: 3925b1669d519e6c038ecce1287c1ced3de623d3 Test-Parameters: trivial Signed-off-by: Serguei Smirnov Change-Id: I79428188c159b2d80d36326589b2977db065d4a7 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/48827 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Andreas Dilger --- lnet/klnds/o2iblnd/o2iblnd_cb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index fc8742a..04cf307 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3223,12 +3223,17 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) case RDMA_CM_EVENT_UNREACHABLE: conn = cmid->context; - LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT || - conn->ibc_state == IBLND_CONN_PASSIVE_WAIT); - CNETERR("%s: UNREACHABLE %d\n", - libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status); - kiblnd_connreq_done(conn, -ENETDOWN); - kiblnd_conn_decref(conn); + CNETERR("%s: UNREACHABLE %d, ibc_state: %d\n", + libcfs_nid2str(conn->ibc_peer->ibp_nid), + event->status, + conn->ibc_state); + LASSERT(conn->ibc_state != IBLND_CONN_ESTABLISHED && + conn->ibc_state != IBLND_CONN_INIT); + if (conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT || + conn->ibc_state == IBLND_CONN_PASSIVE_WAIT) { + kiblnd_connreq_done(conn, -ENETDOWN); + kiblnd_conn_decref(conn); + } return 0; case RDMA_CM_EVENT_CONNECT_ERROR: -- 1.8.3.1