@@ -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
@@ -1286,13 +1287,16 @@ static struct slave *bond_alloc_slave(struct bonding *bond)
1286
1287
return NULL ;
1287
1288
}
1288
1289
}
1290
+ INIT_DELAYED_WORK (& slave -> notify_work , bond_netdev_notify_work );
1291
+
1289
1292
return slave ;
1290
1293
}
1291
1294
1292
1295
static void bond_free_slave (struct slave * slave )
1293
1296
{
1294
1297
struct bonding * bond = bond_get_bond_by_slave (slave );
1295
1298
1299
+ cancel_delayed_work_sync (& slave -> notify_work );
1296
1300
if (BOND_MODE (bond ) == BOND_MODE_8023AD )
1297
1301
kfree (SLAVE_AD_INFO (slave ));
1298
1302
@@ -1314,39 +1318,26 @@ static void bond_fill_ifslave(struct slave *slave, struct ifslave *info)
1314
1318
info -> link_failure_count = slave -> link_failure_count ;
1315
1319
}
1316
1320
1317
- static void bond_netdev_notify (struct net_device * dev ,
1318
- struct netdev_bonding_info * info )
1319
- {
1320
- rtnl_lock ();
1321
- netdev_bonding_info_change (dev , info );
1322
- rtnl_unlock ();
1323
- }
1324
-
1325
1321
static void bond_netdev_notify_work (struct work_struct * _work )
1326
1322
{
1327
- struct netdev_notify_work * w =
1328
- container_of (_work , struct netdev_notify_work , work .work );
1323
+ struct slave * slave = container_of (_work , struct slave ,
1324
+ notify_work .work );
1325
+
1326
+ if (rtnl_trylock ()) {
1327
+ struct netdev_bonding_info binfo ;
1329
1328
1330
- bond_netdev_notify (w -> dev , & w -> bonding_info );
1331
- dev_put (w -> dev );
1332
- kfree (w );
1329
+ bond_fill_ifslave (slave , & binfo .slave );
1330
+ bond_fill_ifbond (slave -> bond , & binfo .master );
1331
+ netdev_bonding_info_change (slave -> dev , & binfo );
1332
+ rtnl_unlock ();
1333
+ } else {
1334
+ queue_delayed_work (slave -> bond -> wq , & slave -> notify_work , 1 );
1335
+ }
1333
1336
}
1334
1337
1335
1338
void bond_queue_slave_event (struct slave * slave )
1336
1339
{
1337
- struct bonding * bond = slave -> bond ;
1338
- struct netdev_notify_work * nnw = kzalloc (sizeof (* nnw ), GFP_ATOMIC );
1339
-
1340
- if (!nnw )
1341
- return ;
1342
-
1343
- dev_hold (slave -> dev );
1344
- nnw -> dev = slave -> dev ;
1345
- bond_fill_ifslave (slave , & nnw -> bonding_info .slave );
1346
- bond_fill_ifbond (bond , & nnw -> bonding_info .master );
1347
- INIT_DELAYED_WORK (& nnw -> work , bond_netdev_notify_work );
1348
-
1349
- queue_delayed_work (slave -> bond -> wq , & nnw -> work , 0 );
1340
+ queue_delayed_work (slave -> bond -> wq , & slave -> notify_work , 0 );
1350
1341
}
1351
1342
1352
1343
void bond_lower_state_changed (struct slave * slave )
0 commit comments