[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVs-_p8VeoRpUjBPSOCkCAi0q8gWWSx29699-UuLKQTrg@mail.gmail.com>
Date: Tue, 31 Jan 2017 09:37:46 -0800
From: Cong Wang <xiyou.wangcong@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: sock_create_kern() and network namespace reference counts
On Tue, Jan 31, 2017 at 7:41 AM, David Laight <David.Laight@...lab.com> wrote:
> Commit 26abe1437 changed sock_create_kern() so that it stopped
> holding a reference to the network namespace.
> The rational seemed to be 'to allow to stop it' (presumably 'be deleted').
> Prior to this change some kernel paths used sk_change_net() (etc) to
> change the namespace after the socket was created.
>
> If the socket doesn't hold a reference to the namespace, what actually
> happens when the namespace is deleted?
Kernel socket should have the same lifetime with the net namespace,
that is, created in net_init and released in net_exit. Think about it, if it
really held a refcnt to this netns, how could this netns be teared down?
Powered by blists - more mailing lists