* [PATCH] net: af_unix should update its inuse counter
@ 2008-11-17 10:09 Eric Dumazet
2008-11-17 10:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2008-11-17 10:09 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
This patch is a preparation to namespace conversion of /proc/net/protocols
In order to have relevant information for UNIX protocol, 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>
---
net/unix/af_unix.c | 4 ++++
1 files changed, 4 insertions(+)
[-- Attachment #2: af_unix_inuse.patch --]
[-- Type: text/plain, Size: 679 bytes --]
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a1eb596..36856ca 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -361,6 +361,7 @@ static void unix_sock_destructor(struct sock *sk)
unix_release_addr(u->addr);
atomic_dec(&unix_nr_socks);
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
#ifdef UNIX_REFCNT_DEBUG
printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk,
atomic_read(&unix_nr_socks));
@@ -612,6 +613,9 @@ static struct sock *unix_create1(struct net *net, struct socket *sock)
out:
if (sk == NULL)
atomic_dec(&unix_nr_socks);
+ else
+ sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
+
return sk;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-17 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-17 10:09 [PATCH] net: af_unix should update its inuse counter Eric Dumazet
2008-11-17 10:39 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.