diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-05-03 06:50:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-03 18:53:54 -0400 |
commit | 4f70ecca9c57731b4acbe5043eb22e4416bd2368 (patch) | |
tree | 3b725168959ffd2b65152e27dbe3479f6e110dd3 /net/ipv6 | |
parent | 52a60ed2da716105de5f906a3630c475264b87d5 (diff) |
net: rcu fixes
Add hlist_for_each_entry_rcu_bh() and
hlist_for_each_entry_continue_rcu_bh() macros, and use them in
ipv6_get_ifaddr(), if6_get_first() and if6_get_next() to fix lockdeps
warnings.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Reviewed-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 34d2d649e396..3984f52181f4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1346,7 +1346,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add | |||
1346 | struct hlist_node *node; | 1346 | struct hlist_node *node; |
1347 | 1347 | ||
1348 | rcu_read_lock_bh(); | 1348 | rcu_read_lock_bh(); |
1349 | hlist_for_each_entry_rcu(ifp, node, &inet6_addr_lst[hash], addr_lst) { | 1349 | hlist_for_each_entry_rcu_bh(ifp, node, &inet6_addr_lst[hash], addr_lst) { |
1350 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 1350 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1351 | continue; | 1351 | continue; |
1352 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1352 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
@@ -2959,7 +2959,7 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq) | |||
2959 | 2959 | ||
2960 | for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { | 2960 | for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { |
2961 | struct hlist_node *n; | 2961 | struct hlist_node *n; |
2962 | hlist_for_each_entry_rcu(ifa, n, &inet6_addr_lst[state->bucket], | 2962 | hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], |
2963 | addr_lst) | 2963 | addr_lst) |
2964 | if (net_eq(dev_net(ifa->idev->dev), net)) | 2964 | if (net_eq(dev_net(ifa->idev->dev), net)) |
2965 | return ifa; | 2965 | return ifa; |
@@ -2974,12 +2974,12 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, | |||
2974 | struct net *net = seq_file_net(seq); | 2974 | struct net *net = seq_file_net(seq); |
2975 | struct hlist_node *n = &ifa->addr_lst; | 2975 | struct hlist_node *n = &ifa->addr_lst; |
2976 | 2976 | ||
2977 | hlist_for_each_entry_continue_rcu(ifa, n, addr_lst) | 2977 | hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) |
2978 | if (net_eq(dev_net(ifa->idev->dev), net)) | 2978 | if (net_eq(dev_net(ifa->idev->dev), net)) |
2979 | return ifa; | 2979 | return ifa; |
2980 | 2980 | ||
2981 | while (++state->bucket < IN6_ADDR_HSIZE) { | 2981 | while (++state->bucket < IN6_ADDR_HSIZE) { |
2982 | hlist_for_each_entry(ifa, n, | 2982 | hlist_for_each_entry_rcu_bh(ifa, n, |
2983 | &inet6_addr_lst[state->bucket], addr_lst) { | 2983 | &inet6_addr_lst[state->bucket], addr_lst) { |
2984 | if (net_eq(dev_net(ifa->idev->dev), net)) | 2984 | if (net_eq(dev_net(ifa->idev->dev), net)) |
2985 | return ifa; | 2985 | return ifa; |
@@ -3000,7 +3000,7 @@ static struct inet6_ifaddr *if6_get_idx(struct seq_file *seq, loff_t pos) | |||
3000 | } | 3000 | } |
3001 | 3001 | ||
3002 | static void *if6_seq_start(struct seq_file *seq, loff_t *pos) | 3002 | static void *if6_seq_start(struct seq_file *seq, loff_t *pos) |
3003 | __acquires(rcu) | 3003 | __acquires(rcu_bh) |
3004 | { | 3004 | { |
3005 | rcu_read_lock_bh(); | 3005 | rcu_read_lock_bh(); |
3006 | return if6_get_idx(seq, *pos); | 3006 | return if6_get_idx(seq, *pos); |
@@ -3016,7 +3016,7 @@ static void *if6_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
3016 | } | 3016 | } |
3017 | 3017 | ||
3018 | static void if6_seq_stop(struct seq_file *seq, void *v) | 3018 | static void if6_seq_stop(struct seq_file *seq, void *v) |
3019 | __releases(rcu) | 3019 | __releases(rcu_bh) |
3020 | { | 3020 | { |
3021 | rcu_read_unlock_bh(); | 3021 | rcu_read_unlock_bh(); |
3022 | } | 3022 | } |
@@ -3093,7 +3093,7 @@ int ipv6_chk_home_addr(struct net *net, struct in6_addr *addr) | |||
3093 | unsigned int hash = ipv6_addr_hash(addr); | 3093 | unsigned int hash = ipv6_addr_hash(addr); |
3094 | 3094 | ||
3095 | rcu_read_lock_bh(); | 3095 | rcu_read_lock_bh(); |
3096 | hlist_for_each_entry_rcu(ifp, n, &inet6_addr_lst[hash], addr_lst) { | 3096 | hlist_for_each_entry_rcu_bh(ifp, n, &inet6_addr_lst[hash], addr_lst) { |
3097 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 3097 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
3098 | continue; | 3098 | continue; |
3099 | if (ipv6_addr_equal(&ifp->addr, addr) && | 3099 | if (ipv6_addr_equal(&ifp->addr, addr) && |
@@ -3127,7 +3127,7 @@ static void addrconf_verify(unsigned long foo) | |||
3127 | 3127 | ||
3128 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { | 3128 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { |
3129 | restart: | 3129 | restart: |
3130 | hlist_for_each_entry_rcu(ifp, node, | 3130 | hlist_for_each_entry_rcu_bh(ifp, node, |
3131 | &inet6_addr_lst[i], addr_lst) { | 3131 | &inet6_addr_lst[i], addr_lst) { |
3132 | unsigned long age; | 3132 | unsigned long age; |
3133 | 3133 | ||