On Tue, Jan 31, 2017 at 7:41 AM, David Laight <david.lai...@aculab.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?