Commit 4ce5a574 authored by Moni Shoua's avatar Moni Shoua Committed by Roland Dreier

IB/mlx4: Move rtnl locking to the right place

On the one hand, the invocation of netdev_master_upper_dev_get()
within mlx4_ib_scan_netdevs() must be done with rtnl lock held.  On
the other hand, it's wrong to call rtnl_lock() from within this
function since it's also called by our netdev notifier callback.
Therefore move the locking to mlx4_ib_add() so that both cases are
covered.
Signed-off-by: default avatarMoni Shoua <monis@mellanox.co.il>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent acc4fccf
...@@ -1707,10 +1707,8 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev) ...@@ -1707,10 +1707,8 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev)
iboe->netdevs[port - 1], port); iboe->netdevs[port - 1], port);
if (iboe->netdevs[port - 1] && if (iboe->netdevs[port - 1] &&
netif_is_bond_slave(iboe->netdevs[port - 1])) { netif_is_bond_slave(iboe->netdevs[port - 1])) {
rtnl_lock();
iboe->masters[port - 1] = netdev_master_upper_dev_get( iboe->masters[port - 1] = netdev_master_upper_dev_get(
iboe->netdevs[port - 1]); iboe->netdevs[port - 1]);
rtnl_unlock();
} }
curr_master = iboe->masters[port - 1]; curr_master = iboe->masters[port - 1];
...@@ -2100,7 +2098,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ...@@ -2100,7 +2098,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
} }
} }
#endif #endif
rtnl_lock();
mlx4_ib_scan_netdevs(ibdev); mlx4_ib_scan_netdevs(ibdev);
rtnl_unlock();
mlx4_ib_init_gid_table(ibdev); mlx4_ib_init_gid_table(ibdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment