@@ -210,6 +210,7 @@ static void bond_get_stats(struct net_device *bond_dev,
210
210
static void bond_slave_arr_handler (struct work_struct * work );
211
211
static bool bond_time_in_interval (struct bonding * bond , unsigned long last_act ,
212
212
int mod );
213
+ static void bond_netdev_notify_work (struct work_struct * work );
213
214
214
215
/*---------------------------- General routines -----------------------------*/
215
216
@@ -1276,13 +1277,16 @@ static struct slave *bond_alloc_slave(struct bonding *bond)
1276
1277
return NULL ;
1277
1278
}
1278
1279
}
1280
+ INIT_DELAYED_WORK (& slave -> notify_work , bond_netdev_notify_work );
1281
+
1279
1282
return slave ;
1280
1283
}
1281
1284
1282
1285
static void bond_free_slave (struct slave * slave )
1283
1286
{
1284
1287
struct bonding * bond = bond_get_bond_by_slave (slave );
1285
1288
1289
+ cancel_delayed_work_sync (& slave -> notify_work );
1286
1290
if (BOND_MODE (bond ) == BOND_MODE_8023AD )
1287
1291
kfree (SLAVE_AD_INFO (slave ));
1288
1292
@@ -1304,39 +1308,26 @@ static void bond_fill_ifslave(struct slave *slave, struct ifslave *info)
1304
1308
info -> link_failure_count = slave -> link_failure_count ;
1305
1309
}
1306
1310
1307
- static void bond_netdev_notify (struct net_device * dev ,
1308
- struct netdev_bonding_info * info )
1309
- {
1310
- rtnl_lock ();
1311
- netdev_bonding_info_change (dev , info );
1312
- rtnl_unlock ();
1313
- }
1314
-
1315
1311
static void bond_netdev_notify_work (struct work_struct * _work )
1316
1312
{
1317
- struct netdev_notify_work * w =
1318
- container_of (_work , struct netdev_notify_work , work .work );
1313
+ struct slave * slave = container_of (_work , struct slave ,
1314
+ notify_work .work );
1315
+
1316
+ if (rtnl_trylock ()) {
1317
+ struct netdev_bonding_info binfo ;
1319
1318
1320
- bond_netdev_notify (w -> dev , & w -> bonding_info );
1321
- dev_put (w -> dev );
1322
- kfree (w );
1319
+ bond_fill_ifslave (slave , & binfo .slave );
1320
+ bond_fill_ifbond (slave -> bond , & binfo .master );
1321
+ netdev_bonding_info_change (slave -> dev , & binfo );
1322
+ rtnl_unlock ();
1323
+ } else {
1324
+ queue_delayed_work (slave -> bond -> wq , & slave -> notify_work , 1 );
1325
+ }
1323
1326
}
1324
1327
1325
1328
void bond_queue_slave_event (struct slave * slave )
1326
1329
{
1327
- struct bonding * bond = slave -> bond ;
1328
- struct netdev_notify_work * nnw = kzalloc (sizeof (* nnw ), GFP_ATOMIC );
1329
-
1330
- if (!nnw )
1331
- return ;
1332
-
1333
- dev_hold (slave -> dev );
1334
- nnw -> dev = slave -> dev ;
1335
- bond_fill_ifslave (slave , & nnw -> bonding_info .slave );
1336
- bond_fill_ifbond (bond , & nnw -> bonding_info .master );
1337
- INIT_DELAYED_WORK (& nnw -> work , bond_netdev_notify_work );
1338
-
1339
- queue_delayed_work (slave -> bond -> wq , & nnw -> work , 0 );
1330
+ queue_delayed_work (slave -> bond -> wq , & slave -> notify_work , 0 );
1340
1331
}
1341
1332
1342
1333
void bond_lower_state_changed (struct slave * slave )
0 commit comments