]> www.infradead.org Git - users/jedix/linux-maple.git/commit
RDS: Use a single TCP socket for both send and receive.
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Wed, 14 Oct 2015 14:29:31 +0000 (10:29 -0400)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Wed, 21 Oct 2015 16:08:35 +0000 (09:08 -0700)
commit414022c18fbb3f25d7fd92a421aa4ea37ecb862c
treed60e0dae17c8dd690aee16c1fe500cc9e6a26155
parent1d5969519ceaabdc65913aee4f1813295299979d
RDS: Use a single TCP socket for both send and receive.

Orabug: 22012202

Backport of upstream commit 3b20fc389705 ("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>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
net/rds/connection.c
net/rds/rds.h
net/rds/tcp_listen.c