On Mon, Nov 13, 2017 at 4:36 AM, Tonghao Zhang <xiangxia.m....@gmail.com> wrote:
> From: Tonghao Zhang <xiangxia.m....@gmail.com>
>
> This patch add a member in struct netns_core. and this is
> a counter for socket_inuse in the _net_ namespace. The patch
> will add/sub counter in the sock_alloc or sock_release. In
> the sock_alloc, the private data of inode saves the special
> _net_. When releasing it, we can access the special _net_ and
> dec the counter of socket in that namespace.
>
> By the way, we dont use the 'current->nsproxy->net_ns' in the
> sock_release. In one case,when one task exits, the 'do_exit'
> may set the current->nsproxy NULL, and then call the sock_release.
> Use the private data of inode, saving few bytes.

Why do you need to hold netns refcnt for socket? sock already holds
it, so you can just access it by sock_net(sock->sk) ?

Reply via email to