aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-30 04:27:58 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-30 22:41:13 -0500
commitc33e7b05f1411b97cd0260ae682fc1cdb27bfaa4 (patch)
treed00958e4600cbef4a45b4622df6b3a9c4e205fa4 /net
parent18367681a10bd29c3f2305e6b7b984de5b33d548 (diff)
ipv6 anycast: Convert ipv6_sk_ac_lock to spinlock.
Since all users are write-lock, it does not make sense to use rwlock here. Use simple spinlock. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/anycast.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 757a810d8f15..921b8b398a8c 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -47,7 +47,7 @@
47static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr); 47static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr);
48 48
49/* Big ac list lock for all the sockets */ 49/* Big ac list lock for all the sockets */
50static DEFINE_RWLOCK(ipv6_sk_ac_lock); 50static DEFINE_SPINLOCK(ipv6_sk_ac_lock);
51 51
52 52
53/* 53/*
@@ -128,10 +128,10 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
128 128
129 err = ipv6_dev_ac_inc(dev, addr); 129 err = ipv6_dev_ac_inc(dev, addr);
130 if (!err) { 130 if (!err) {
131 write_lock_bh(&ipv6_sk_ac_lock); 131 spin_lock_bh(&ipv6_sk_ac_lock);
132 pac->acl_next = np->ipv6_ac_list; 132 pac->acl_next = np->ipv6_ac_list;
133 np->ipv6_ac_list = pac; 133 np->ipv6_ac_list = pac;
134 write_unlock_bh(&ipv6_sk_ac_lock); 134 spin_unlock_bh(&ipv6_sk_ac_lock);
135 pac = NULL; 135 pac = NULL;
136 } 136 }
137 137
@@ -152,7 +152,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
152 struct ipv6_ac_socklist *pac, *prev_pac; 152 struct ipv6_ac_socklist *pac, *prev_pac;
153 struct net *net = sock_net(sk); 153 struct net *net = sock_net(sk);
154 154
155 write_lock_bh(&ipv6_sk_ac_lock); 155 spin_lock_bh(&ipv6_sk_ac_lock);
156 prev_pac = NULL; 156 prev_pac = NULL;
157 for (pac = np->ipv6_ac_list; pac; pac = pac->acl_next) { 157 for (pac = np->ipv6_ac_list; pac; pac = pac->acl_next) {
158 if ((ifindex == 0 || pac->acl_ifindex == ifindex) && 158 if ((ifindex == 0 || pac->acl_ifindex == ifindex) &&
@@ -161,7 +161,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
161 prev_pac = pac; 161 prev_pac = pac;
162 } 162 }
163 if (!pac) { 163 if (!pac) {
164 write_unlock_bh(&ipv6_sk_ac_lock); 164 spin_unlock_bh(&ipv6_sk_ac_lock);
165 return -ENOENT; 165 return -ENOENT;
166 } 166 }
167 if (prev_pac) 167 if (prev_pac)
@@ -169,7 +169,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
169 else 169 else
170 np->ipv6_ac_list = pac->acl_next; 170 np->ipv6_ac_list = pac->acl_next;
171 171
172 write_unlock_bh(&ipv6_sk_ac_lock); 172 spin_unlock_bh(&ipv6_sk_ac_lock);
173 173
174 rcu_read_lock(); 174 rcu_read_lock();
175 dev = dev_get_by_index_rcu(net, pac->acl_ifindex); 175 dev = dev_get_by_index_rcu(net, pac->acl_ifindex);
@@ -192,10 +192,10 @@ void ipv6_sock_ac_close(struct sock *sk)
192 if (!np->ipv6_ac_list) 192 if (!np->ipv6_ac_list)
193 return; 193 return;
194 194
195 write_lock_bh(&ipv6_sk_ac_lock); 195 spin_lock_bh(&ipv6_sk_ac_lock);
196 pac = np->ipv6_ac_list; 196 pac = np->ipv6_ac_list;
197 np->ipv6_ac_list = NULL; 197 np->ipv6_ac_list = NULL;
198 write_unlock_bh(&ipv6_sk_ac_lock); 198 spin_unlock_bh(&ipv6_sk_ac_lock);
199 199
200 prev_index = 0; 200 prev_index = 0;
201 rcu_read_lock(); 201 rcu_read_lock();