[lustre-devel] [PATCH 15/20] lnet: o2iblnd: fix handling of RDMA_CM_EVENT_UNREACHABLE

James Simmons <[email protected]>
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Serguei Smirnov <[email protected]>

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.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15885
Lustre-commit: 3925b1669d519e6c0 ("LU-15885 o2iblnd: fix handling of RDMA_CM_EVENT_UNREACHABLE")
Signed-off-by: Serguei Smirnov <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48492
Reviewed-by: Frank Sehr <[email protected]>
Reviewed-by: Chris Horn <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 30e77c0382f1..919b83d5c6e2 100644
--- a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -3171,13 +3171,17 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
 		return event->status;	/* rc destroys cmid */
 
 	case RDMA_CM_EVENT_UNREACHABLE:
-		conn = (struct kib_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:
-- 
2.27.0

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.