diff --git a/net/core/dev.c b/net/core/dev.c index cbb5918e4fc550223e9f9fe2037df17d217218cf..09aef266d4d1b5ef2c4116acf6954c08880fff72 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5235,7 +5235,7 @@ static void rollback_registered_many(struct list_head *head) dev = list_first_entry(head, struct net_device, unreg_list); call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH, dev); - rcu_barrier(); + synchronize_net(); list_for_each_entry(dev, head, unreg_list) dev_put(dev); @@ -5748,6 +5748,12 @@ void netdev_run_todo(void) __rtnl_unlock(); + /* Wait for rcu callbacks to finish before attempting to drain + * the device list. This usually avoids a 250ms wait. + */ + if (!list_empty(&list)) + rcu_barrier(); + while (!list_empty(&list)) { struct net_device *dev = list_first_entry(&list, struct net_device, todo_list);