>From 3344e2e0431fe803c4dac8757a8746908357d780 Mon Sep 17 00:00:00 2001 From: Nicolas Dichtel Date: Tue, 28 Sep 2010 16:38:19 +0200 Subject: [PATCH] ipv4: remove all rt cache entries on UNREGISTER event Commit e2ce146848c81af2f6d42e67990191c284bf0c33 (ipv4: factorize cache clearing for batched unregister operations) add a new parameter to fib_disable_ip() to only invalidate route cache entries on unregister event. This is wrong, we should ensure that all cache entries are removed on unregister event, else netdev_wait_allrefs() may complain. A cache entry can be created between event DOWN and UNREGISTER. So, I revert a part of the patch. Signed-off-by: Nicolas Dichtel --- net/ipv4/fib_frontend.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 7d02a9f..377e815 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -917,11 +917,11 @@ static void nl_fib_lookup_exit(struct net *net) net->ipv4.fibnl = NULL; } -static void fib_disable_ip(struct net_device *dev, int force, int delay) +static void fib_disable_ip(struct net_device *dev, int force) { if (fib_sync_down_dev(dev, force)) fib_flush(dev_net(dev)); - rt_cache_flush(dev_net(dev), delay); + rt_cache_flush(dev_net(dev), 0); arp_ifdown(dev); } @@ -944,7 +944,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, /* Last address was deleted from this interface. Disable IP. */ - fib_disable_ip(dev, 1, 0); + fib_disable_ip(dev, 1); } else { rt_cache_flush(dev_net(dev), -1); } @@ -959,7 +959,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo struct in_device *in_dev = __in_dev_get_rtnl(dev); if (event == NETDEV_UNREGISTER) { - fib_disable_ip(dev, 2, -1); + fib_disable_ip(dev, 2); return NOTIFY_DONE; } @@ -977,7 +977,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo rt_cache_flush(dev_net(dev), -1); break; case NETDEV_DOWN: - fib_disable_ip(dev, 0, 0); + fib_disable_ip(dev, 0); break; case NETDEV_CHANGEMTU: case NETDEV_CHANGE: -- 1.5.6.5