From a5ee13ea4ae4b8acef5dcbab2d6ab4e14718ef0a Mon Sep 17 00:00:00 2001 From: Zhu Yanjun Date: Tue, 17 Jul 2018 03:03:05 -0400 Subject: [PATCH] rds: IB: fix returned value not set error When IB port link up/down too frequently, the following will occur. " 16:57:08 kernel: mlx5_core 0000:af:00.1 enp175s0f1: Link up 16:57:08 kernel: RDS/IB: PORT-EVENT: port active, PORT: mlx5_0/port_2/enp175s0f1 : port state transition to UP (portlayers 0x7) 16:57:08 kernel: RDS/IB: NET-EVENT: NETDEV-CHANGE, PORT mlx5_0/port_2/enp175s0f1 : port state transition NONE - port retained in state UP (portlayers 0x7) 16:57:13 kernel: mlx5_core 0000:af:00.1 enp175s0f1: Link down 16:57:13 kernel: RDS/IB: PORT-EVENT: port error, PORT: mlx5_0/port_2/enp175s0f1 : port state transition to DOWN (portlayers 0x4) 16:57:13 kernel: RDS/IB: NET-EVENT: NETDEV-CHANGE, PORT mlx5_0/port_2/enp175s0f1 : port state transition NONE - port retained in state DOWN (portlayers 0x4) 16:57:13 kernel: RDS/IB: Address already exist 16:57:17 kernel: mlx5_core 0000:af:00.1 enp175s0f1: Link up 16:57:17 kernel: RDS/IB: PORT-EVENT: port active, PORT: mlx5_0/port_2/enp175s0f1 : port state transition to UP (portlayers 0x7) 16:57:17 kernel: RDS/IB: NET-EVENT: NETDEV-CHANGE, PORT mlx5_0/port_2/enp175s0f1 : port state transition NONE - port retained in state UP (portlayers 0x7) 16:57:18 kernel: RDS/IB: IPv4 172.16.2.52 migrated from enp175s0f0 (port 1) to enp175s0f1 (port 2) " From the above, rds_ib_addr_exist is called to check ip address. If exists, the function goes to the end directly while the ret is not set. This is not reasonable. This will make some global variables error. Orabug: 28356474 Signed-off-by: Zhu Yanjun Reviewed-by: Shamir Rabinovitch Signed-off-by: Brian Maly --- net/rds/ib.c | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/net/rds/ib.c b/net/rds/ib.c index 572fe0f309ab..954d4aeb80d3 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -954,8 +954,11 @@ static int rds_ib_move_ip4(char *from_dev, /* Bailout if IP already exists on target port */ if (rds_ib_addr_exist(ip_config[to_port].dev, &addr, NULL, - false)) + false)) { + printk(KERN_ERR "RDS/IP: Address already exist\n"); + ret = -EADDRINUSE; goto out; + } active_port = ip_config[from_port].ip_active_port; if (alias || active_port == from_port) { @@ -1380,17 +1383,13 @@ static void rds_ib_do_failover(u8 from_port, u8 to_port, u8 arp_port, struct rds_ib_alias *alias; alias = &ip_config[from_port].aliases[j]; - ret = rds_ib_move_ip4(alias->if_name, - ip_config[to_port].if_name, - from_port, - to_port, - arp_port, - alias->ip_addr, - alias->ip_bcast, - alias->ip_mask, - event_type, - 1, - 1); + rds_ib_move_ip4(alias->if_name, + ip_config[to_port].if_name, + from_port, to_port, arp_port, + alias->ip_addr, + alias->ip_bcast, + alias->ip_mask, + event_type, 1, 1); } } @@ -1433,17 +1432,14 @@ static void rds_ib_do_failback(u8 port, int event_type) struct rds_ib_alias *alias; alias = &ip_config[port].aliases[j]; - ret = rds_ib_move_ip4(from_name, - alias->if_name, - ip_active_port, - port, - ip_active_port, - alias->ip_addr, - alias->ip_bcast, - alias->ip_mask, - event_type, - 1, - 0); + rds_ib_move_ip4(from_name, alias->if_name, + ip_active_port, + port, + ip_active_port, + alias->ip_addr, + alias->ip_bcast, + alias->ip_mask, + event_type, 1, 0); } } -- 2.50.1