RDS: don't update ip address tables if the address hasn't changed
authorsantosh.shilimkar@oracle.com <santosh.shilimkar@oracle.com>
Sat, 22 Aug 2015 22:45:25 +0000 (15:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2015 20:35:29 +0000 (13:35 -0700)
If the ip address tables hasn't changed, there is no need to remove
them only to be added back again.

Lets fix it.
Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/ib_rdma.c

index 657ba9f5d30862a1f8add1302e8364bcd4ad44dc..e49c9568b4a5c52d4e9b38d71756e3f782429c6f 100644 (file)
@@ -151,12 +151,17 @@ int rds_ib_update_ipaddr(struct rds_ib_device *rds_ibdev, __be32 ipaddr)
        struct rds_ib_device *rds_ibdev_old;
 
        rds_ibdev_old = rds_ib_get_device(ipaddr);
-       if (rds_ibdev_old) {
+       if (!rds_ibdev_old)
+               return rds_ib_add_ipaddr(rds_ibdev, ipaddr);
+
+       if (rds_ibdev_old != rds_ibdev) {
                rds_ib_remove_ipaddr(rds_ibdev_old, ipaddr);
                rds_ib_dev_put(rds_ibdev_old);
+               return rds_ib_add_ipaddr(rds_ibdev, ipaddr);
        }
+       rds_ib_dev_put(rds_ibdev_old);
 
-       return rds_ib_add_ipaddr(rds_ibdev, ipaddr);
+       return 0;
 }
 
 void rds_ib_add_conn(struct rds_ib_device *rds_ibdev, struct rds_connection *conn)