]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: TCP: Avoid rds connection churn from rogue SYNs
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Mon, 6 Jun 2016 21:47:18 +0000 (14:47 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 10 Aug 2016 23:04:31 +0000 (16:04 -0700)
Orabug: 23542064

Backport of upstream commmit c948bb5c2cc4 ("RDS: TCP: Avoid rds connection
churn from rogue SYNs")

When a rogue SYN is received after the connection arbitration
algorithm has converged, the incoming SYN should not needlessly
quiesce the transmit path, and it should not result in needless
TCP connection resets due to re-execution of the connection
arbitration logic.

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

index 38a6df62cdb7d41df86458628784076c17d3e129..5c82e4cbd02f10f140c4633527e4a8613b3470ad 100644 (file)
@@ -131,12 +131,13 @@ int rds_tcp_accept_one(struct socket *sock)
                 * so we must quiesce any send threads before resetting
                 * c_transport_data.
                 */
-               atomic_set(&conn->c_state, RDS_CONN_CONNECTING);
-               wait_event(conn->c_waitq,
-                          !test_bit(RDS_IN_XMIT, &conn->c_flags));
-               if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
+               if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr) ||
+                   !conn->c_outgoing) {
                        goto rst_nsk;
-               } else if (rs_tcp->t_sock) {
+               } else {
+                       atomic_set(&conn->c_state, RDS_CONN_CONNECTING);
+                       wait_event(conn->c_waitq,
+                                  !test_bit(RDS_IN_XMIT, &conn->c_flags));
                        rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
                        conn->c_outgoing = 0;
                }