From 8d77b95b3f1d7bcf7f026170196de9f5eddc7f76 Mon Sep 17 00:00:00 2001 From: eeb Date: Sun, 9 Jan 2005 19:52:51 +0000 Subject: [PATCH] * Fixed bug in destroying idle persistent peer --- lnet/klnds/openiblnd/openiblnd.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lnet/klnds/openiblnd/openiblnd.c b/lnet/klnds/openiblnd/openiblnd.c index 9bf9985..8443c87 100644 --- a/lnet/klnds/openiblnd/openiblnd.c +++ b/lnet/klnds/openiblnd/openiblnd.c @@ -339,6 +339,8 @@ kibnal_create_peer (ptl_nid_t nid) peer->ibp_reconnect_interval = IBNAL_MIN_RECONNECT_INTERVAL; atomic_inc (&kibnal_data.kib_npeers); + CDEBUG(D_NET, "peer %p "LPX64"\n", peer, nid); + return (peer); } @@ -508,13 +510,19 @@ kibnal_del_peer_locked (kib_peer_t *peer, int single_share) if (peer->ibp_persistence != 0) return; - list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { - conn = list_entry(ctmp, kib_conn_t, ibc_list); + if (list_empty(&peer->ibp_conns)) { + kibnal_unlink_peer_locked(peer); + } else { + list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { + conn = list_entry(ctmp, kib_conn_t, ibc_list); - kibnal_close_conn_locked (conn, 0); + kibnal_close_conn_locked (conn, 0); + } + /* NB peer is no longer persistent; closing its last conn + * unlinked it. */ } - - /* NB peer unlinks itself when last conn is closed */ + /* NB peer now unlinked; might even be freed if the peer table had the + * last ref on it. */ } int -- 1.8.3.1