netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: af_netlink should update its inuse counter
@ 2008-11-22  8:40 Eric Dumazet
  2008-11-23 23:48 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2008-11-22  8:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

In order to have relevant information for NETLINK protocol, in
/proc/net/protocols, we should use sock_prot_inuse_add() to
update a (percpu and pernamespace) counter of inuse sockets.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

[-- Attachment #2: af_netlink.patch --]
[-- Type: text/plain, Size: 597 bytes --]

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 480184a..a2071dc 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -452,6 +452,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol)
 	if (err < 0)
 		goto out_module;
 
+	sock_prot_inuse_add(net, &netlink_proto, 1);
 	nlk = nlk_sk(sock->sk);
 	nlk->module = module;
 out:
@@ -511,6 +512,7 @@ static int netlink_release(struct socket *sock)
 	kfree(nlk->groups);
 	nlk->groups = NULL;
 
+	sock_prot_inuse_add(sock_net(sk), &netlink_proto, -1);
 	sock_put(sk);
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-23 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-22  8:40 [PATCH] net: af_netlink should update its inuse counter Eric Dumazet
2008-11-23 23:48 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).