aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-01-02 00:58:02 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:00:31 -0500
commit9a429c4983deae020f1e757ecc8f547b6d4e2f2b (patch)
tree172e27a5866e182b902cd77506df1755aafadb60
parentb950dfcf504842a0f2bb142a33ef938f1c00d300 (diff)
[NET]: Add some acquires/releases sparse annotations.
Add __acquires() and __releases() annotations to suppress some sparse warnings. example of warnings : net/ipv4/udp.c:1555:14: warning: context imbalance in 'udp_seq_start' - wrong count at exit net/ipv4/udp.c:1571:13: warning: context imbalance in 'udp_seq_stop' - unexpected unlock Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/dev_mcast.c2
-rw-r--r--net/core/gen_stats.c1
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/ipv4/fib_hash.c2
-rw-r--r--net/ipv4/inet_hashtables.c1
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/anycast.c2
-rw-r--r--net/ipv6/ip6_flowlabel.c2
-rw-r--r--net/ipv6/mcast.c4
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/sched/sch_generic.c4
-rw-r--r--net/sunrpc/cache.c2
-rw-r--r--net/unix/af_unix.c2
-rw-r--r--net/xfrm/xfrm_state.c2
16 files changed, 36 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 7153e94f50a..eee77424309 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2368,6 +2368,7 @@ static int dev_ifconf(struct net *net, char __user *arg)
2368 * in detail. 2368 * in detail.
2369 */ 2369 */
2370void *dev_seq_start(struct seq_file *seq, loff_t *pos) 2370void *dev_seq_start(struct seq_file *seq, loff_t *pos)
2371 __acquires(dev_base_lock)
2371{ 2372{
2372 struct net *net = seq_file_net(seq); 2373 struct net *net = seq_file_net(seq);
2373 loff_t off; 2374 loff_t off;
@@ -2394,6 +2395,7 @@ void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2394} 2395}
2395 2396
2396void dev_seq_stop(struct seq_file *seq, void *v) 2397void dev_seq_stop(struct seq_file *seq, void *v)
2398 __releases(dev_base_lock)
2397{ 2399{
2398 read_unlock(&dev_base_lock); 2400 read_unlock(&dev_base_lock);
2399} 2401}
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 63f0b33d7ce..cadbfbf7e7f 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -186,6 +186,7 @@ EXPORT_SYMBOL(dev_mc_unsync);
186 186
187#ifdef CONFIG_PROC_FS 187#ifdef CONFIG_PROC_FS
188static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos) 188static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
189 __acquires(dev_base_lock)
189{ 190{
190 struct net *net = seq_file_net(seq); 191 struct net *net = seq_file_net(seq);
191 struct net_device *dev; 192 struct net_device *dev;
@@ -206,6 +207,7 @@ static void *dev_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
206} 207}
207 208
208static void dev_mc_seq_stop(struct seq_file *seq, void *v) 209static void dev_mc_seq_stop(struct seq_file *seq, void *v)
210 __releases(dev_base_lock)
209{ 211{
210 read_unlock(&dev_base_lock); 212 read_unlock(&dev_base_lock);
211} 213}
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index bcc25591d8a..8073561f7c6 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -55,6 +55,7 @@ rtattr_failure:
55int 55int
56gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, 56gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
57 int xstats_type, spinlock_t *lock, struct gnet_dump *d) 57 int xstats_type, spinlock_t *lock, struct gnet_dump *d)
58 __acquires(lock)
58{ 59{
59 memset(d, 0, sizeof(*d)); 60 memset(d, 0, sizeof(*d));
60 61
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index bd899d55773..802493327a8 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2313,6 +2313,7 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos)
2313} 2313}
2314 2314
2315void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl, unsigned int neigh_seq_flags) 2315void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl, unsigned int neigh_seq_flags)
2316 __acquires(tbl->lock)
2316{ 2317{
2317 struct neigh_seq_state *state = seq->private; 2318 struct neigh_seq_state *state = seq->private;
2318 loff_t pos_minus_one; 2319 loff_t pos_minus_one;
@@ -2356,6 +2357,7 @@ out:
2356EXPORT_SYMBOL(neigh_seq_next); 2357EXPORT_SYMBOL(neigh_seq_next);
2357 2358
2358void neigh_seq_stop(struct seq_file *seq, void *v) 2359void neigh_seq_stop(struct seq_file *seq, void *v)
2360 __releases(tbl->lock)
2359{ 2361{
2360 struct neigh_seq_state *state = seq->private; 2362 struct neigh_seq_state *state = seq->private;
2361 struct neigh_table *tbl = state->tbl; 2363 struct neigh_table *tbl = state->tbl;
diff --git a/net/core/sock.c b/net/core/sock.c
index 3804e7df626..3d7757ee2fc 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2025,6 +2025,7 @@ EXPORT_SYMBOL(proto_unregister);
2025 2025
2026#ifdef CONFIG_PROC_FS 2026#ifdef CONFIG_PROC_FS
2027static void *proto_seq_start(struct seq_file *seq, loff_t *pos) 2027static void *proto_seq_start(struct seq_file *seq, loff_t *pos)
2028 __acquires(proto_list_lock)
2028{ 2029{
2029 read_lock(&proto_list_lock); 2030 read_lock(&proto_list_lock);
2030 return seq_list_start_head(&proto_list, *pos); 2031 return seq_list_start_head(&proto_list, *pos);
@@ -2036,6 +2037,7 @@ static void *proto_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2036} 2037}
2037 2038
2038static void proto_seq_stop(struct seq_file *seq, void *v) 2039static void proto_seq_stop(struct seq_file *seq, void *v)
2040 __releases(proto_list_lock)
2039{ 2041{
2040 read_unlock(&proto_list_lock); 2042 read_unlock(&proto_list_lock);
2041} 2043}
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 9d540415847..ee1ffdb3044 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -936,6 +936,7 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
936} 936}
937 937
938static void *fib_seq_start(struct seq_file *seq, loff_t *pos) 938static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
939 __acquires(fib_hash_lock)
939{ 940{
940 void *v = NULL; 941 void *v = NULL;
941 942
@@ -952,6 +953,7 @@ static void *fib_seq_next(struct seq_file *seq, void *v, loff_t *pos)
952} 953}
953 954
954static void fib_seq_stop(struct seq_file *seq, void *v) 955static void fib_seq_stop(struct seq_file *seq, void *v)
956 __releases(fib_hash_lock)
955{ 957{
956 read_unlock(&fib_hash_lock); 958 read_unlock(&fib_hash_lock);
957} 959}
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 2e5814a8436..88a059e04e3 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -96,6 +96,7 @@ EXPORT_SYMBOL(inet_put_port);
96 * exclusive lock release). It should be ifdefed really. 96 * exclusive lock release). It should be ifdefed really.
97 */ 97 */
98void inet_listen_wlock(struct inet_hashinfo *hashinfo) 98void inet_listen_wlock(struct inet_hashinfo *hashinfo)
99 __acquires(hashinfo->lhash_lock)
99{ 100{
100 write_lock(&hashinfo->lhash_lock); 101 write_lock(&hashinfo->lhash_lock);
101 102
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 35328436075..02fcccd0486 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1550,6 +1550,7 @@ static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
1550} 1550}
1551 1551
1552static void *udp_seq_start(struct seq_file *seq, loff_t *pos) 1552static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
1553 __acquires(udp_hash_lock)
1553{ 1554{
1554 read_lock(&udp_hash_lock); 1555 read_lock(&udp_hash_lock);
1555 return *pos ? udp_get_idx(seq, *pos-1) : (void *)1; 1556 return *pos ? udp_get_idx(seq, *pos-1) : (void *)1;
@@ -1569,6 +1570,7 @@ static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1569} 1570}
1570 1571
1571static void udp_seq_stop(struct seq_file *seq, void *v) 1572static void udp_seq_stop(struct seq_file *seq, void *v)
1573 __releases(udp_hash_lock)
1572{ 1574{
1573 read_unlock(&udp_hash_lock); 1575 read_unlock(&udp_hash_lock);
1574} 1576}
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index f915c4df982..5c4190060e7 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -504,6 +504,7 @@ static struct ifacaddr6 *ac6_get_idx(struct seq_file *seq, loff_t pos)
504} 504}
505 505
506static void *ac6_seq_start(struct seq_file *seq, loff_t *pos) 506static void *ac6_seq_start(struct seq_file *seq, loff_t *pos)
507 __acquires(dev_base_lock)
507{ 508{
508 read_lock(&dev_base_lock); 509 read_lock(&dev_base_lock);
509 return ac6_get_idx(seq, *pos); 510 return ac6_get_idx(seq, *pos);
@@ -518,6 +519,7 @@ static void *ac6_seq_next(struct seq_file *seq, void *v, loff_t *pos)
518} 519}
519 520
520static void ac6_seq_stop(struct seq_file *seq, void *v) 521static void ac6_seq_stop(struct seq_file *seq, void *v)
522 __releases(dev_base_lock)
521{ 523{
522 struct ac6_iter_state *state = ac6_seq_private(seq); 524 struct ac6_iter_state *state = ac6_seq_private(seq);
523 if (likely(state->idev != NULL)) { 525 if (likely(state->idev != NULL)) {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index d0babea8981..2b7d9ee9883 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -629,6 +629,7 @@ static struct ip6_flowlabel *ip6fl_get_idx(struct seq_file *seq, loff_t pos)
629} 629}
630 630
631static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos) 631static void *ip6fl_seq_start(struct seq_file *seq, loff_t *pos)
632 __acquires(ip6_fl_lock)
632{ 633{
633 read_lock_bh(&ip6_fl_lock); 634 read_lock_bh(&ip6_fl_lock);
634 return *pos ? ip6fl_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; 635 return *pos ? ip6fl_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
@@ -647,6 +648,7 @@ static void *ip6fl_seq_next(struct seq_file *seq, void *v, loff_t *pos)
647} 648}
648 649
649static void ip6fl_seq_stop(struct seq_file *seq, void *v) 650static void ip6fl_seq_stop(struct seq_file *seq, void *v)
651 __releases(ip6_fl_lock)
650{ 652{
651 read_unlock_bh(&ip6_fl_lock); 653 read_unlock_bh(&ip6_fl_lock);
652} 654}
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 82b12940c2a..ab228d1ea11 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2373,6 +2373,7 @@ static struct ifmcaddr6 *igmp6_mc_get_idx(struct seq_file *seq, loff_t pos)
2373} 2373}
2374 2374
2375static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos) 2375static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos)
2376 __acquires(dev_base_lock)
2376{ 2377{
2377 read_lock(&dev_base_lock); 2378 read_lock(&dev_base_lock);
2378 return igmp6_mc_get_idx(seq, *pos); 2379 return igmp6_mc_get_idx(seq, *pos);
@@ -2387,6 +2388,7 @@ static void *igmp6_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2387} 2388}
2388 2389
2389static void igmp6_mc_seq_stop(struct seq_file *seq, void *v) 2390static void igmp6_mc_seq_stop(struct seq_file *seq, void *v)
2391 __releases(dev_base_lock)
2390{ 2392{
2391 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2393 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2392 if (likely(state->idev != NULL)) { 2394 if (likely(state->idev != NULL)) {
@@ -2516,6 +2518,7 @@ static struct ip6_sf_list *igmp6_mcf_get_idx(struct seq_file *seq, loff_t pos)
2516} 2518}
2517 2519
2518static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos) 2520static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos)
2521 __acquires(dev_base_lock)
2519{ 2522{
2520 read_lock(&dev_base_lock); 2523 read_lock(&dev_base_lock);
2521 return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; 2524 return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
@@ -2533,6 +2536,7 @@ static void *igmp6_mcf_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2533} 2536}
2534 2537
2535static void igmp6_mcf_seq_stop(struct seq_file *seq, void *v) 2538static void igmp6_mcf_seq_stop(struct seq_file *seq, void *v)
2539 __releases(dev_base_lock)
2536{ 2540{
2537 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2541 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2538 if (likely(state->im != NULL)) { 2542 if (likely(state->im != NULL)) {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index dbd7cad1c9a..be07f1b45ee 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -171,6 +171,7 @@ static void netlink_sock_destruct(struct sock *sk)
171 */ 171 */
172 172
173static void netlink_table_grab(void) 173static void netlink_table_grab(void)
174 __acquires(nl_table_lock)
174{ 175{
175 write_lock_irq(&nl_table_lock); 176 write_lock_irq(&nl_table_lock);
176 177
@@ -193,6 +194,7 @@ static void netlink_table_grab(void)
193} 194}
194 195
195static inline void netlink_table_ungrab(void) 196static inline void netlink_table_ungrab(void)
197 __releases(nl_table_lock)
196{ 198{
197 write_unlock_irq(&nl_table_lock); 199 write_unlock_irq(&nl_table_lock);
198 wake_up(&nl_table_wait); 200 wake_up(&nl_table_wait);
@@ -1728,6 +1730,7 @@ static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
1728} 1730}
1729 1731
1730static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) 1732static void *netlink_seq_start(struct seq_file *seq, loff_t *pos)
1733 __acquires(nl_table_lock)
1731{ 1734{
1732 read_lock(&nl_table_lock); 1735 read_lock(&nl_table_lock);
1733 return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; 1736 return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN;
@@ -1776,6 +1779,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
1776} 1779}
1777 1780
1778static void netlink_seq_stop(struct seq_file *seq, void *v) 1781static void netlink_seq_stop(struct seq_file *seq, void *v)
1782 __releases(nl_table_lock)
1779{ 1783{
1780 read_unlock(&nl_table_lock); 1784 read_unlock(&nl_table_lock);
1781} 1785}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 9be2f152455..ea5a05b172c 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -40,12 +40,16 @@
40 */ 40 */
41 41
42void qdisc_lock_tree(struct net_device *dev) 42void qdisc_lock_tree(struct net_device *dev)
43 __acquires(dev->queue_lock)
44 __acquires(dev->ingress_lock)
43{ 45{
44 spin_lock_bh(&dev->queue_lock); 46 spin_lock_bh(&dev->queue_lock);
45 spin_lock(&dev->ingress_lock); 47 spin_lock(&dev->ingress_lock);
46} 48}
47 49
48void qdisc_unlock_tree(struct net_device *dev) 50void qdisc_unlock_tree(struct net_device *dev)
51 __releases(dev->ingress_lock)
52 __releases(dev->queue_lock)
49{ 53{
50 spin_unlock(&dev->ingress_lock); 54 spin_unlock(&dev->ingress_lock);
51 spin_unlock_bh(&dev->queue_lock); 55 spin_unlock_bh(&dev->queue_lock);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 8e05557414c..73f053d0cc7 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1127,6 +1127,7 @@ struct handle {
1127}; 1127};
1128 1128
1129static void *c_start(struct seq_file *m, loff_t *pos) 1129static void *c_start(struct seq_file *m, loff_t *pos)
1130 __acquires(cd->hash_lock)
1130{ 1131{
1131 loff_t n = *pos; 1132 loff_t n = *pos;
1132 unsigned hash, entry; 1133 unsigned hash, entry;
@@ -1183,6 +1184,7 @@ static void *c_next(struct seq_file *m, void *p, loff_t *pos)
1183} 1184}
1184 1185
1185static void c_stop(struct seq_file *m, void *p) 1186static void c_stop(struct seq_file *m, void *p)
1187 __releases(cd->hash_lock)
1186{ 1188{
1187 struct cache_detail *cd = ((struct handle*)m->private)->cd; 1189 struct cache_detail *cd = ((struct handle*)m->private)->cd;
1188 read_unlock(&cd->hash_lock); 1190 read_unlock(&cd->hash_lock);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 63a9239571a..eea75888805 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2033,6 +2033,7 @@ static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos)
2033 2033
2034 2034
2035static void *unix_seq_start(struct seq_file *seq, loff_t *pos) 2035static void *unix_seq_start(struct seq_file *seq, loff_t *pos)
2036 __acquires(unix_table_lock)
2036{ 2037{
2037 struct unix_iter_state *iter = seq->private; 2038 struct unix_iter_state *iter = seq->private;
2038 spin_lock(&unix_table_lock); 2039 spin_lock(&unix_table_lock);
@@ -2055,6 +2056,7 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2055} 2056}
2056 2057
2057static void unix_seq_stop(struct seq_file *seq, void *v) 2058static void unix_seq_stop(struct seq_file *seq, void *v)
2059 __releases(unix_table_lock)
2058{ 2060{
2059 spin_unlock(&unix_table_lock); 2061 spin_unlock(&unix_table_lock);
2060} 2062}
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 6bf876c866d..65f5ea4ae4c 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -211,6 +211,7 @@ static struct xfrm_state_afinfo *xfrm_state_lock_afinfo(unsigned int family)
211} 211}
212 212
213static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo) 213static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo)
214 __releases(xfrm_state_afinfo_lock)
214{ 215{
215 write_unlock_bh(&xfrm_state_afinfo_lock); 216 write_unlock_bh(&xfrm_state_afinfo_lock);
216} 217}
@@ -1909,6 +1910,7 @@ static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family)
1909} 1910}
1910 1911
1911static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo) 1912static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo)
1913 __releases(xfrm_state_afinfo_lock)
1912{ 1914{
1913 read_unlock(&xfrm_state_afinfo_lock); 1915 read_unlock(&xfrm_state_afinfo_lock);
1914} 1916}