aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorYan Zheng <yanzheng@21cn.com>2005-11-20 16:42:20 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-20 16:42:20 -0500
commit5d5780df23537ad0db72267fe11103d2c23d9b2a (patch)
tree3a442b265c3494072d4cdf15c8d3a38ada33a734 /net/ipv6/addrconf.c
parent4909724b5dee8fb7c52bbe90afa40c65b17be9eb (diff)
[IPV6]: Acquire addrconf_hash_lock for read in addrconf_verify(...)
addrconf_verify(...) only traverse address hash table when addrconf_hash_lock is held for writing, and it may hold addrconf_hash_lock for a long time. So I think it's better to acquire addrconf_hash_lock for reading instead of writing Signed-off-by: Yan Zheng <yanzheng@21cn.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 56a09a4ac410..a16064ba0caf 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2627,7 +2627,7 @@ static void addrconf_verify(unsigned long foo)
2627 for (i=0; i < IN6_ADDR_HSIZE; i++) { 2627 for (i=0; i < IN6_ADDR_HSIZE; i++) {
2628 2628
2629restart: 2629restart:
2630 write_lock(&addrconf_hash_lock); 2630 read_lock(&addrconf_hash_lock);
2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) { 2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) {
2632 unsigned long age; 2632 unsigned long age;
2633#ifdef CONFIG_IPV6_PRIVACY 2633#ifdef CONFIG_IPV6_PRIVACY
@@ -2649,7 +2649,7 @@ restart:
2649 if (age >= ifp->valid_lft) { 2649 if (age >= ifp->valid_lft) {
2650 spin_unlock(&ifp->lock); 2650 spin_unlock(&ifp->lock);
2651 in6_ifa_hold(ifp); 2651 in6_ifa_hold(ifp);
2652 write_unlock(&addrconf_hash_lock); 2652 read_unlock(&addrconf_hash_lock);
2653 ipv6_del_addr(ifp); 2653 ipv6_del_addr(ifp);
2654 goto restart; 2654 goto restart;
2655 } else if (age >= ifp->prefered_lft) { 2655 } else if (age >= ifp->prefered_lft) {
@@ -2668,7 +2668,7 @@ restart:
2668 2668
2669 if (deprecate) { 2669 if (deprecate) {
2670 in6_ifa_hold(ifp); 2670 in6_ifa_hold(ifp);
2671 write_unlock(&addrconf_hash_lock); 2671 read_unlock(&addrconf_hash_lock);
2672 2672
2673 ipv6_ifa_notify(0, ifp); 2673 ipv6_ifa_notify(0, ifp);
2674 in6_ifa_put(ifp); 2674 in6_ifa_put(ifp);
@@ -2686,7 +2686,7 @@ restart:
2686 in6_ifa_hold(ifp); 2686 in6_ifa_hold(ifp);
2687 in6_ifa_hold(ifpub); 2687 in6_ifa_hold(ifpub);
2688 spin_unlock(&ifp->lock); 2688 spin_unlock(&ifp->lock);
2689 write_unlock(&addrconf_hash_lock); 2689 read_unlock(&addrconf_hash_lock);
2690 ipv6_create_tempaddr(ifpub, ifp); 2690 ipv6_create_tempaddr(ifpub, ifp);
2691 in6_ifa_put(ifpub); 2691 in6_ifa_put(ifpub);
2692 in6_ifa_put(ifp); 2692 in6_ifa_put(ifp);
@@ -2703,7 +2703,7 @@ restart:
2703 spin_unlock(&ifp->lock); 2703 spin_unlock(&ifp->lock);
2704 } 2704 }
2705 } 2705 }
2706 write_unlock(&addrconf_hash_lock); 2706 read_unlock(&addrconf_hash_lock);
2707 } 2707 }
2708 2708
2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next; 2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next;