]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: alias failover is not working properly
authorBang Nguyen <bang.nguyen@oracle.com>
Fri, 19 Jul 2013 19:05:16 +0000 (12:05 -0700)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Wed, 8 Jul 2015 20:59:37 +0000 (13:59 -0700)
This can lead to crashes or duplicate addresses. Alias will be
failed over in the following form:

e.g.,  ib0:<alias> -> ib1:P**:<alias>

Orabug: 17177994

Signed-off-by: zheng.li <zheng.x.li@oracle.com>
(cherry picked from commit 049a5ec115391ef1ad171825c4b7630550ae3328)

net/rds/ib.c

index 47f7d91c38507db64d9a74e6622ce2812dae2263..d7ed0a5f5c9f306a361077890b6d2725f7fe7851 100644 (file)
@@ -537,6 +537,7 @@ static int rds_ib_move_ip(char                      *from_dev,
                        __be32                  bcast,
                        __be32                  mask,
                        int                     event_type,
+                       int                     alias,
                        int                     failover)
 {
        struct ifreq            *ir;
@@ -544,8 +545,9 @@ static int rds_ib_move_ip(char                      *from_dev,
        struct page             *page;
        char                    from_dev2[2*IFNAMSIZ + 1];
        char                    to_dev2[2*IFNAMSIZ + 1];
+       char                    *tmp_str;
        int                     ret = 0;
-       u8                      active_port, i, port = 0;
+       u8                      active_port, i, j, port = 0;
        struct in_device        *in_dev;
        struct rds_ib_connection *ic, *ic2;
        struct rds_ib_device *rds_ibdev;
@@ -592,6 +594,10 @@ static int rds_ib_move_ip(char                     *from_dev,
                        strcpy(to_dev2, to_dev);
                        strcat(to_dev2, ":");
                        strcat(to_dev2, ip_config[from_port].port_label);
+                       if (alias) {
+                               tmp_str = strchr(from_dev, ':');
+                               strcat(to_dev2, tmp_str);
+                       }
                        to_dev2[IFNAMSIZ-1] = 0;
                }
                if (in_dev)
@@ -602,7 +608,7 @@ static int rds_ib_move_ip(char                      *from_dev,
                        goto out;
 
                active_port = ip_config[from_port].ip_active_port;
-               if (active_port == from_port) {
+               if (alias || active_port == from_port) {
                        strcpy(from_dev2, from_dev);
                } else if (ip_config[active_port].port_state ==
                                RDS_IB_PORT_UP) {
@@ -669,6 +675,13 @@ static int rds_ib_move_ip(char                     *from_dev,
                                                        port = i;
                                                        break;
                                                }
+
+                                               for (j = 0; j < ip_config[i].alias_cnt; j++) {
+                                                       if (ip_config[i].aliases[j].ip_addr == ic->conn->c_faddr) {
+                                                               port = i;
+                                                               break;
+                                                       }
+                                               }
                                        }
 
                                        BUG_ON(!port);
@@ -835,6 +848,7 @@ static void rds_ib_do_failover(u8 from_port, u8 to_port, u8 arp_port,
                        ip_config[from_port].ip_bcast,
                        ip_config[from_port].ip_mask,
                        event_type,
+                       0,
                        1)) {
 
                        ip_config[from_port].ip_active_port = to_port;
@@ -855,6 +869,7 @@ static void rds_ib_do_failover(u8 from_port, u8 to_port, u8 arp_port,
                                        ip_config[from_port].
                                                aliases[j].ip_mask,
                                        event_type,
+                                       1,
                                        1);
                        }
                }
@@ -881,6 +896,7 @@ static void rds_ib_do_failback(u8 port, int event_type)
                        ip_config[port].ip_bcast,
                        ip_config[port].ip_mask,
                        event_type,
+                       0,
                        0)) {
 
                        ip_config[port].ip_active_port = port;
@@ -902,6 +918,7 @@ static void rds_ib_do_failback(u8 port, int event_type)
                                        ip_config[port].
                                                aliases[j].ip_mask,
                                        event_type,
+                                       1,
                                        0);
                        }
                }