]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/rds: Fix incorrect bigger vs. smaller IP address check
authorHåkon Bugge <Haakon.Bugge@oracle.com>
Tue, 26 Jun 2018 14:14:06 +0000 (16:14 +0200)
committerBrian Maly <brian.maly@oracle.com>
Thu, 5 Jul 2018 19:13:31 +0000 (15:13 -0400)
In commit d8bd5dfb5de4 ("net/rds: use one sided reconnection during a
race"), the function rds_addr_cmp() was called without comparing the
return value to less-than or bigger-than-equal to zero.

This led to a situation where both peers thought they were the winner,
and consequently, racing RDS connections didn't form or took a long
time to form.

The issue is fixed by this commit.

Orabug: 28236599

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Suggested-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Fixes: d8bd5dfb5de4 ("net/rds: use one sided reconnection during a race")
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
(cherry picked from commit 653ccd08be01f82c6129f5060bd8110489aca110
repo UEK/linux-hbugge-public.git)

Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
   * Had to "rename" the SHA of the Fixes: uek-5-master commit to
     the correct one for uek-4.1-qu7.

Signed-off-by: Brian Maly <brian.maly@oracle.com>
net/rds/threads.c

index 5a81e321d13cc4dea816f758e5f632f816b50278..12ac53c360cbda2a6ada09d87b8988cda9961cab 100644 (file)
@@ -160,7 +160,7 @@ void rds_queue_reconnect(struct rds_conn_path *cp)
                    rand % cp->cp_reconnect_jiffies, cp->cp_reconnect_jiffies,
                    conn, &conn->c_laddr, &conn->c_faddr, conn->c_tos);
 
-       if (rds_addr_cmp(&conn->c_laddr, &conn->c_faddr))
+       if (rds_addr_cmp(&conn->c_laddr, &conn->c_faddr) >= 0)
                queue_delayed_work(cp->cp_wq, &cp->cp_conn_w, 0);
        else
                queue_delayed_work(cp->cp_wq, &cp->cp_conn_w,
@@ -338,10 +338,10 @@ void rds_shutdown_worker(struct work_struct *work)
                        conn->c_tos,
                        conn_drop_reason_str(cp->cp_drop_source));
 
-       /* if racing is detected, lower IP backs off and let the higher IP
-        * drives the reconnect (one-sided reconnect)
+       /* If racing is detected, the bigger IP backs off and lets the
+        * smaller IP drive the reconnect (one-sided reconnect).
         */
-       if ((rds_addr_cmp(&conn->c_faddr, &conn->c_laddr) ||
+       if ((rds_addr_cmp(&conn->c_laddr, &conn->c_faddr) < 0 ||
             rds_conn_self_loopback_passive(conn)) &&
            cp->cp_reconnect_racing) {
                rds_rtd_ptr(RDS_RTD_CM,