aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-08-22 13:19:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-23 00:50:36 -0400
commit0115e8e30d6fcdd4b8faa30d3ffd90859a591f51 (patch)
tree725026e2192e57b98366947ab53c73689ca040a8 /net/ipv4/fib_frontend.c
parentbf277b0ccea7d2422b85e232017ce3fddbe9c49c (diff)
net: remove delay at device dismantle
I noticed extra one second delay in device dismantle, tracked down to a call to dst_dev_event() while some call_rcu() are still in RCU queues. These call_rcu() were posted by rt_free(struct rtable *rt) calls. We then wait a little (but one second) in netdev_wait_allrefs() before kicking again NETDEV_UNREGISTER. As the call_rcu() are now completed, dst_dev_event() can do the needed device swap on busy dst. To solve this problem, add a new NETDEV_UNREGISTER_FINAL, called after a rcu_barrier(), but outside of RTNL lock. Use NETDEV_UNREGISTER_FINAL with care ! Change dst_dev_event() handler to react to NETDEV_UNREGISTER_FINAL Also remove NETDEV_UNREGISTER_BATCH, as its not used anymore after IP cache removal. With help from Gao feng Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Tom Herbert <therbert@google.com> Cc: Mahesh Bandewar <maheshb@google.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7f073a38c87d..fd7d9ae64f16 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1041,7 +1041,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
1041static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) 1041static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
1042{ 1042{
1043 struct net_device *dev = ptr; 1043 struct net_device *dev = ptr;
1044 struct in_device *in_dev = __in_dev_get_rtnl(dev); 1044 struct in_device *in_dev;
1045 struct net *net = dev_net(dev); 1045 struct net *net = dev_net(dev);
1046 1046
1047 if (event == NETDEV_UNREGISTER) { 1047 if (event == NETDEV_UNREGISTER) {
@@ -1050,9 +1050,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
1050 return NOTIFY_DONE; 1050 return NOTIFY_DONE;
1051 } 1051 }
1052 1052
1053 if (!in_dev) 1053 if (event == NETDEV_UNREGISTER_FINAL)
1054 return NOTIFY_DONE; 1054 return NOTIFY_DONE;
1055 1055
1056 in_dev = __in_dev_get_rtnl(dev);
1057
1056 switch (event) { 1058 switch (event) {
1057 case NETDEV_UP: 1059 case NETDEV_UP:
1058 for_ifa(in_dev) { 1060 for_ifa(in_dev) {
@@ -1071,8 +1073,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
1071 case NETDEV_CHANGE: 1073 case NETDEV_CHANGE:
1072 rt_cache_flush(dev_net(dev), 0); 1074 rt_cache_flush(dev_net(dev), 0);
1073 break; 1075 break;
1074 case NETDEV_UNREGISTER_BATCH:
1075 break;
1076 } 1076 }
1077 return NOTIFY_DONE; 1077 return NOTIFY_DONE;
1078} 1078}