RDS: Use a single TCP socket for both send and receive.
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Wed, 30 Sep 2015 20:54:07 +0000 (16:54 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2015 10:34:51 +0000 (03:34 -0700)
commit3b20fc389705a4c959adebc494578cb99bb8be9e
treec108cf3b2a4221995ae3b8c7dc91431fc5322b0e
parent393159e917242c39a5c07173914a0e2a2367ee69
RDS: Use a single TCP socket for both send and receive.

Commit f711a6ae062c ("net/rds: RDS-TCP: Always create a new rds_sock
for an incoming connection.") modified rds-tcp so that an incoming SYN
would ignore an existing "client" TCP connection which had the local
port set to the transient port.  The motivation for ignoring the existing
"client" connection in f711a6ae was to avoid race conditions and an
endless duel of reconnect attempts triggered by a restart/abort of one
of the nodes in the TCP connection.

However, having separate sockets for active and passive sides
is avoidable, and the simpler model of a single TCP socket for
both send and receives of all RDS connections associated with
that tcp socket makes for easier observability. We avoid the race
conditions from f711a6ae by attempting reconnects in rds_conn_shutdown
if, and only if, the (new) c_outgoing bit is set for RDS_TRANS_TCP.
The c_outgoing bit is initialized in __rds_conn_create().

A side-effect of re-using the client rds_connection for an incoming
SYN is the potential of encountering duelling SYNs, i.e., we
have an outgoing RDS_CONN_CONNECTING socket when we get the incoming
SYN. The logic to arbitrate this criss-crossing SYN exchange in
rds_tcp_accept_one() has been modified to emulate the BGP state
machine: the smaller IP address should back off from the connection attempt.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/connection.c
net/rds/rds.h
net/rds/tcp_listen.c
This page took 0.026117 seconds and 5 git commands to generate.