Skip to content

Commit

Permalink
prov/rxm: fix address comparison to remove duplicate connections
Browse files Browse the repository at this point in the history
The address comparison to determine whether to reject or keep a duplicate
connection was incorrect and falsely identifying too many loopback
connections. The address to compare against should be the local EP's
address, not the peer's address.

This fix exposes an issue with the reject/close path which was not being
taken before. A race condition during simultaneous connections was
occurring where both sides sent a connection request. One side received
a connection request, accepted, and closed its outgoing connection.
However, the connection request had already been received by the peer,
causing the peer to incorrectly identify that connection as a lost
connection, causing send failures for any outstanding sends on that
active connection.

This patch could potentially cause issues in how lost connections are
managed, but testing to date has not shown any issues... yet...

Signed-off-by: aingerson <alexia.ingerson@intel.com>
  • Loading branch information
aingerson authored and ooststep committed Jul 30, 2021
1 parent 8f1c597 commit 4acbd64
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions prov/rxm/src/rxm_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ rxm_process_connreq(struct rxm_ep *ep, struct rxm_eq_cm_entry *cm_entry)
break;
case RXM_CM_CONNECTING:
/* simultaneous connections */
cmp = ofi_addr_cmp(&rxm_prov, &peer_addr.sa, &peer->addr.sa);
cmp = ofi_addr_cmp(&rxm_prov, &peer_addr.sa, &ep->addr.sa);
if (cmp < 0) {
/* let our request finish */
rxm_reject_connreq(ep, cm_entry,
Expand All @@ -558,9 +558,7 @@ rxm_process_connreq(struct rxm_ep *ep, struct rxm_eq_cm_entry *cm_entry)
break;
case RXM_CM_ACCEPTING:
case RXM_CM_CONNECTED:
/* peer reset and lost previous connection state */
rxm_close_conn(conn);
break;
goto put;
default:
assert(0);
break;
Expand Down

0 comments on commit 4acbd64

Please sign in to comment.