RDS: TCP: Simplify reconnect to avoid duelling reconnnect attempts
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Thu, 30 Jun 2016 23:11:17 +0000 (16:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Jul 2016 20:45:17 +0000 (16:45 -0400)
When reconnecting, the peer with the smaller IP address will initiate
the reconnect, to avoid needless duelling SYN issues.

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

index 1b0c2a783b5e724cef7b8cb5894e5ef8ff1646f0..19a4fee5f4ddc150d560952bba9a48a84add8771 100644 (file)
@@ -355,9 +355,7 @@ void rds_conn_shutdown(struct rds_conn_path *cp)
        rcu_read_lock();
        if (!hlist_unhashed(&conn->c_hash_node)) {
                rcu_read_unlock();
-               if (conn->c_trans->t_type != RDS_TRANS_TCP ||
-                   cp->cp_outgoing == 1)
-                       rds_queue_reconnect(cp);
+               rds_queue_reconnect(cp);
        } else {
                rcu_read_unlock();
        }
index e8f0941f05487f2c3aec3757478c6bfbac5c292b..bc97d67f29cc24b328efa6d921199dd112127672 100644 (file)
@@ -125,6 +125,11 @@ void rds_queue_reconnect(struct rds_conn_path *cp)
          conn, &conn->c_laddr, &conn->c_faddr,
          cp->cp_reconnect_jiffies);
 
+       /* let peer with smaller addr initiate reconnect, to avoid duels */
+       if (conn->c_trans->t_type == RDS_TRANS_TCP &&
+           conn->c_laddr > conn->c_faddr)
+               return;
+
        set_bit(RDS_RECONNECT_PENDING, &cp->cp_flags);
        if (cp->cp_reconnect_jiffies == 0) {
                cp->cp_reconnect_jiffies = rds_sysctl_reconnect_min_jiffies;