]> www.infradead.org Git - users/jedix/linux-maple.git/commit
RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one()
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Thu, 15 Oct 2015 02:11:54 +0000 (22:11 -0400)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Wed, 21 Oct 2015 16:09:39 +0000 (09:09 -0700)
commite6d85a7ad00d0e93c1da18cd6e5ebdee4a3d8a08
tree949d0ccd0ba6db96405e8a1b5b8241151fb6bcb5
parent8a2c912b27e0a66760bc9f25ae36d025f1920eb7
RDS-TCP: Reset tcp callbacks if re-using an outgoing socket in rds_tcp_accept_one()

Orabug: 22012202

Backport of upstream commit 241b271952eb ("RDS-TCP: Reset tcp callbacks
if re-using an outgoing socket in rds_tcp_accept_one()")

Consider the following "duelling syn" sequence between two peers A and B:
             A B
             SYN1     -->
                  <-- SYN2
             SYN2ACK  -->

Note that the SYN/ACK has already been sent out by TCP before
rds_tcp_accept_one() gets invoked as part of callbacks.

If the inet_addr(A) is numerically less than inet_addr(B),
the arbitration scheme in rds_tcp_accept_one() will prefer the
TCP connection triggered by SYN1, and will send a CLOSE for the
SYN2 (just after the SYN2ACK was sent).

Since B also follows the same arbitration scheme, it will send the SYN-ACK
for SYN1 that will set up a healthy ESTABLISHED connection on both sides.
B will also get a  CLOSE for SYN2, which should result in the cleanup
of the TCP state machine for SYN2, but it should not trigger any
stale RDS-TCP callbacks (such as ->writespace, ->state_change etc),
that would disrupt the progress of the SYN2 based RDS-TCP  connection.

Thus the arbitration scheme in rds_tcp_accept_one() should restore
rds_tcp callbacks for the winner before setting them up for the
new accept socket, and also make sure that conn->c_outgoing
is set to 0 so that we do not trigger any reconnect attempts on the
passive side of the tcp socket in the future, in conformance with
commit c82ac7e69efe ("net/rds: RDS-TCP: only initiate reconnect attempt
on outgoing TCP socket.")

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/tcp_listen.c