@@ -1717,6 +1717,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1717
1717
goto err_upper_unlink ;
1718
1718
}
1719
1719
1720
+ bond -> nest_level = dev_get_nest_level (bond_dev ) + 1 ;
1721
+
1720
1722
/* If the mode uses primary, then the following is handled by
1721
1723
* bond_change_active_slave().
1722
1724
*/
@@ -1764,7 +1766,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1764
1766
if (bond_mode_can_use_xmit_hash (bond ))
1765
1767
bond_update_slave_arr (bond , NULL );
1766
1768
1767
- bond -> nest_level = dev_get_nest_level (bond_dev );
1768
1769
1769
1770
netdev_info (bond_dev , "Enslaving %s as %s interface with %s link\n" ,
1770
1771
slave_dev -> name ,
@@ -3415,6 +3416,13 @@ static void bond_fold_stats(struct rtnl_link_stats64 *_res,
3415
3416
}
3416
3417
}
3417
3418
3419
+ static int bond_get_nest_level (struct net_device * bond_dev )
3420
+ {
3421
+ struct bonding * bond = netdev_priv (bond_dev );
3422
+
3423
+ return bond -> nest_level ;
3424
+ }
3425
+
3418
3426
static void bond_get_stats (struct net_device * bond_dev ,
3419
3427
struct rtnl_link_stats64 * stats )
3420
3428
{
@@ -3423,7 +3431,7 @@ static void bond_get_stats(struct net_device *bond_dev,
3423
3431
struct list_head * iter ;
3424
3432
struct slave * slave ;
3425
3433
3426
- spin_lock (& bond -> stats_lock );
3434
+ spin_lock_nested (& bond -> stats_lock , bond_get_nest_level ( bond_dev ) );
3427
3435
memcpy (stats , & bond -> bond_stats , sizeof (* stats ));
3428
3436
3429
3437
rcu_read_lock ();
@@ -4227,6 +4235,7 @@ static const struct net_device_ops bond_netdev_ops = {
4227
4235
.ndo_neigh_setup = bond_neigh_setup ,
4228
4236
.ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid ,
4229
4237
.ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid ,
4238
+ .ndo_get_lock_subclass = bond_get_nest_level ,
4230
4239
#ifdef CONFIG_NET_POLL_CONTROLLER
4231
4240
.ndo_netpoll_setup = bond_netpoll_setup ,
4232
4241
.ndo_netpoll_cleanup = bond_netpoll_cleanup ,
@@ -4725,6 +4734,7 @@ static int bond_init(struct net_device *bond_dev)
4725
4734
if (!bond -> wq )
4726
4735
return - ENOMEM ;
4727
4736
4737
+ bond -> nest_level = SINGLE_DEPTH_NESTING ;
4728
4738
netdev_lockdep_set_classes (bond_dev );
4729
4739
4730
4740
list_add_tail (& bond -> bond_list , & bn -> dev_list );
0 commit comments