]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: disable IP failover if device removed
authorBang Nguyen <bang.nguyen@oracle.com>
Fri, 26 Jul 2013 23:10:29 +0000 (16:10 -0700)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Wed, 8 Jul 2015 20:59:39 +0000 (13:59 -0700)
IP failover after the device has been removed can lead to panic.

The fix is to disable IP failover if the underlying device has been removed.

Orabug: 17206167

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

net/rds/ib.c

index d7ed0a5f5c9f306a361077890b6d2725f7fe7851..849cc4746e6c100bdd99fa1805ad57fb58bba9bb 100644 (file)
@@ -227,13 +227,19 @@ struct rds_ib_device *rds_ib_get_client_data(struct ib_device *device)
 void rds_ib_remove_one(struct ib_device *device)
 {
        struct rds_ib_device *rds_ibdev;
+       int i;
 
        rds_ibdev = ib_get_client_data(device, &rds_ib_client);
        if (!rds_ibdev)
                return;
 
-       if (rds_ib_active_bonding_enabled)
+       if (rds_ib_active_bonding_enabled) {
+               for (i = 1; i <= ip_port_cnt; i++) {
+                       if (ip_config[i].rds_ibdev == rds_ibdev)
+                               ip_config[i].rds_ibdev = NULL;
+               }
                ib_unregister_event_handler(&rds_ibdev->event_handler);
+       }
 
        rds_ib_dev_shutdown(rds_ibdev);
 
@@ -654,6 +660,9 @@ static int rds_ib_move_ip(char                      *from_dev,
                                NIPQUAD(addr), from_dev2, to_dev2);
 
                rds_ibdev = ip_config[from_port].rds_ibdev;
+               if (!rds_ibdev)
+                       goto out;
+
                spin_lock_bh(&rds_ibdev->spinlock);
                list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node) {
                        if (ic->conn->c_laddr == addr) {
@@ -1461,6 +1470,9 @@ static int rds_ib_netdev_callback(struct notifier_block *self, unsigned long eve
        if (!port)
                return NOTIFY_DONE;
 
+       if (ip_config[port].rds_ibdev == NULL)
+               return NOTIFY_DONE;
+
        work = kzalloc(sizeof *work, GFP_ATOMIC);
        if (!work) {
                printk(KERN_ERR "RDS/IB: failed to allocate port work\n");