diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-11 00:39:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-11 00:39:26 -0500 |
commit | c2b42336f4a733020360157ba629d37f1410923a (patch) | |
tree | 8b923bb8cd76f4ec637ad2b2e6843bc85e0c52f3 /net | |
parent | 17ab56a260734aabf7f03cc97785dda81571ea24 (diff) |
[IPX]: Use existing sock refcnt debugging infrastructure
Just like in the af_packet.c, the ipx_sock_nr variable is used
for debugging purposes.
Switch to using existing infrastructure. Thanks to Arnaldo for
pointing this out.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipx/af_ipx.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index a195a66e0cc7..c76a9523091b 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -92,11 +92,6 @@ extern int ipxrtr_route_skb(struct sk_buff *skb); | |||
92 | extern struct ipx_route *ipxrtr_lookup(__be32 net); | 92 | extern struct ipx_route *ipxrtr_lookup(__be32 net); |
93 | extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); | 93 | extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); |
94 | 94 | ||
95 | #undef IPX_REFCNT_DEBUG | ||
96 | #ifdef IPX_REFCNT_DEBUG | ||
97 | atomic_t ipx_sock_nr; | ||
98 | #endif | ||
99 | |||
100 | struct ipx_interface *ipx_interfaces_head(void) | 95 | struct ipx_interface *ipx_interfaces_head(void) |
101 | { | 96 | { |
102 | struct ipx_interface *rc = NULL; | 97 | struct ipx_interface *rc = NULL; |
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk) | |||
151 | { | 146 | { |
152 | ipx_remove_socket(sk); | 147 | ipx_remove_socket(sk); |
153 | skb_queue_purge(&sk->sk_receive_queue); | 148 | skb_queue_purge(&sk->sk_receive_queue); |
154 | #ifdef IPX_REFCNT_DEBUG | 149 | sk_refcnt_debug_dec(sk); |
155 | atomic_dec(&ipx_sock_nr); | ||
156 | printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk, | ||
157 | atomic_read(&ipx_sock_nr)); | ||
158 | if (atomic_read(&sk->sk_refcnt) != 1) | ||
159 | printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n", | ||
160 | sk, atomic_read(&sk->sk_refcnt)); | ||
161 | #endif | ||
162 | sock_put(sk); | 150 | sock_put(sk); |
163 | } | 151 | } |
164 | 152 | ||
@@ -1384,11 +1372,8 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol) | |||
1384 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); | 1372 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); |
1385 | if (!sk) | 1373 | if (!sk) |
1386 | goto out; | 1374 | goto out; |
1387 | #ifdef IPX_REFCNT_DEBUG | 1375 | |
1388 | atomic_inc(&ipx_sock_nr); | 1376 | sk_refcnt_debug_inc(sk); |
1389 | printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk, | ||
1390 | atomic_read(&ipx_sock_nr)); | ||
1391 | #endif | ||
1392 | sock_init_data(sock, sk); | 1377 | sock_init_data(sock, sk); |
1393 | sk->sk_no_check = 1; /* Checksum off by default */ | 1378 | sk->sk_no_check = 1; /* Checksum off by default */ |
1394 | sock->ops = &ipx_dgram_ops; | 1379 | sock->ops = &ipx_dgram_ops; |
@@ -1409,6 +1394,7 @@ static int ipx_release(struct socket *sock) | |||
1409 | 1394 | ||
1410 | sock_set_flag(sk, SOCK_DEAD); | 1395 | sock_set_flag(sk, SOCK_DEAD); |
1411 | sock->sk = NULL; | 1396 | sock->sk = NULL; |
1397 | sk_refcnt_debug_release(sk); | ||
1412 | ipx_destroy_socket(sk); | 1398 | ipx_destroy_socket(sk); |
1413 | out: | 1399 | out: |
1414 | return 0; | 1400 | return 0; |