diff options
author | Michal Kubeček <mkubecek@suse.cz> | 2016-03-08 08:44:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-08 15:16:51 -0500 |
commit | 3dc94f93be161ec4203673de9a34b7362d8985b5 (patch) | |
tree | b06f18cb9a5fdac6ab626dd9368361fe606a2874 | |
parent | 9a03cd8f38efb83c13fbe62aff50eea4efff93da (diff) |
ipv6: per netns FIB garbage collection
One of our customers observed issues with FIB6 garbage collectors
running in different network namespaces blocking each other, resulting
in soft lockups (fib6_run_gc() initiated from timer runs always in
forced mode).
Now that FIB6 walkers are separated per namespace, there is no more need
for instances of fib6_run_gc() in different namespaces blocking each
other. There is still a call to icmp6_dst_gc() which operates on shared
data but this function is protected by its own shared lock.
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netns/ipv6.h | 1 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index f0109b973648..10d0848f5b8a 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
@@ -61,6 +61,7 @@ struct netns_ipv6 { | |||
61 | struct list_head fib6_walkers; | 61 | struct list_head fib6_walkers; |
62 | struct dst_ops ip6_dst_ops; | 62 | struct dst_ops ip6_dst_ops; |
63 | rwlock_t fib6_walker_lock; | 63 | rwlock_t fib6_walker_lock; |
64 | spinlock_t fib6_gc_lock; | ||
64 | unsigned int ip6_rt_gc_expire; | 65 | unsigned int ip6_rt_gc_expire; |
65 | unsigned long ip6_rt_last_gc; | 66 | unsigned long ip6_rt_last_gc; |
66 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 67 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 883f2836beab..ea071fad67a0 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -1776,16 +1776,14 @@ static int fib6_age(struct rt6_info *rt, void *arg) | |||
1776 | return 0; | 1776 | return 0; |
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | static DEFINE_SPINLOCK(fib6_gc_lock); | ||
1780 | |||
1781 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) | 1779 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) |
1782 | { | 1780 | { |
1783 | struct fib6_gc_args gc_args; | 1781 | struct fib6_gc_args gc_args; |
1784 | unsigned long now; | 1782 | unsigned long now; |
1785 | 1783 | ||
1786 | if (force) { | 1784 | if (force) { |
1787 | spin_lock_bh(&fib6_gc_lock); | 1785 | spin_lock_bh(&net->ipv6.fib6_gc_lock); |
1788 | } else if (!spin_trylock_bh(&fib6_gc_lock)) { | 1786 | } else if (!spin_trylock_bh(&net->ipv6.fib6_gc_lock)) { |
1789 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); | 1787 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1790 | return; | 1788 | return; |
1791 | } | 1789 | } |
@@ -1804,7 +1802,7 @@ void fib6_run_gc(unsigned long expires, struct net *net, bool force) | |||
1804 | + net->ipv6.sysctl.ip6_rt_gc_interval)); | 1802 | + net->ipv6.sysctl.ip6_rt_gc_interval)); |
1805 | else | 1803 | else |
1806 | del_timer(&net->ipv6.ip6_fib_timer); | 1804 | del_timer(&net->ipv6.ip6_fib_timer); |
1807 | spin_unlock_bh(&fib6_gc_lock); | 1805 | spin_unlock_bh(&net->ipv6.fib6_gc_lock); |
1808 | } | 1806 | } |
1809 | 1807 | ||
1810 | static void fib6_gc_timer_cb(unsigned long arg) | 1808 | static void fib6_gc_timer_cb(unsigned long arg) |
@@ -1816,6 +1814,7 @@ static int __net_init fib6_net_init(struct net *net) | |||
1816 | { | 1814 | { |
1817 | size_t size = sizeof(struct hlist_head) * FIB6_TABLE_HASHSZ; | 1815 | size_t size = sizeof(struct hlist_head) * FIB6_TABLE_HASHSZ; |
1818 | 1816 | ||
1817 | spin_lock_init(&net->ipv6.fib6_gc_lock); | ||
1819 | rwlock_init(&net->ipv6.fib6_walker_lock); | 1818 | rwlock_init(&net->ipv6.fib6_walker_lock); |
1820 | INIT_LIST_HEAD(&net->ipv6.fib6_walkers); | 1819 | INIT_LIST_HEAD(&net->ipv6.fib6_walkers); |
1821 | setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); | 1820 | setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); |