* [PATCH 06/21] nfs client: exit_net cleanup check added @ 2017-11-05 10:00 Vasily Averin [not found] ` <5cbecaf0-dbb6-4140-43ed-ae94fc161941-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Vasily Averin @ 2017-11-05 10:00 UTC (permalink / raw) To: netdev; +Cc: linux-nfs, Anna Schumaker, Trond Myklebust Be sure that nfs_client_list and nfs_volume_list lists initialized in net_init hook were return to initial state in net_exit hook. Signed-off-by: Vasily Averin <vvs@virtuozzo.com> --- fs/nfs/client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 22880ef..7c0691c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) struct nfs_net *nn = net_generic(net, nfs_net_id); idr_destroy(&nn->cb_ident_idr); + WARN(!list_empty(&nn->nfs_client_list), + "net %p exit: nfs_client_list is not empty\n", net); + WARN(!list_empty(&nn->nfs_volume_list), + "net %p exit: nfs_volume_list is not empty\n", net); } /* nfs_client_lock held */ -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <5cbecaf0-dbb6-4140-43ed-ae94fc161941-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>]
* Re: [PATCH 06/21] nfs client: exit_net cleanup check added [not found] ` <5cbecaf0-dbb6-4140-43ed-ae94fc161941-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> @ 2017-11-05 16:02 ` Trond Myklebust 2017-11-05 16:48 ` Vasily Averin 0 siblings, 1 reply; 4+ messages in thread From: Trond Myklebust @ 2017-11-05 16:02 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org Cc: anna.schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Sun, 2017-11-05 at 13:00 +0300, Vasily Averin wrote: > Be sure that nfs_client_list and nfs_volume_list lists initialized > in net_init hook were return to initial state in net_exit hook. > > Signed-off-by: Vasily Averin <vvs@virtuozzo.com> > --- > fs/nfs/client.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/nfs/client.c b/fs/nfs/client.c > index 22880ef..7c0691c 100644 > --- a/fs/nfs/client.c > +++ b/fs/nfs/client.c > @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) > struct nfs_net *nn = net_generic(net, nfs_net_id); > > idr_destroy(&nn->cb_ident_idr); > + WARN(!list_empty(&nn->nfs_client_list), > + "net %p exit: nfs_client_list is not empty\n", net); > + WARN(!list_empty(&nn->nfs_volume_list), > + "net %p exit: nfs_volume_list is not empty\n", net); > } > Why do we need these? Is there a specific bug that you are trying to track down? -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.myklebust@primarydata.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 06/21] nfs client: exit_net cleanup check added 2017-11-05 16:02 ` Trond Myklebust @ 2017-11-05 16:48 ` Vasily Averin [not found] ` <297fee4f-3cef-9bd4-d683-a14559939b65-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Vasily Averin @ 2017-11-05 16:48 UTC (permalink / raw) To: Trond Myklebust, netdev@vger.kernel.org Cc: anna.schumaker@netapp.com, linux-nfs@vger.kernel.org On 2017-11-05 19:02, Trond Myklebust wrote: > On Sun, 2017-11-05 at 13:00 +0300, Vasily Averin wrote: >> Be sure that nfs_client_list and nfs_volume_list lists initialized >> in net_init hook were return to initial state in net_exit hook. >> >> Signed-off-by: Vasily Averin <vvs@virtuozzo.com> >> --- >> fs/nfs/client.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/fs/nfs/client.c b/fs/nfs/client.c >> index 22880ef..7c0691c 100644 >> --- a/fs/nfs/client.c >> +++ b/fs/nfs/client.c >> @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net *net) >> struct nfs_net *nn = net_generic(net, nfs_net_id); >> >> idr_destroy(&nn->cb_ident_idr); >> + WARN(!list_empty(&nn->nfs_client_list), >> + "net %p exit: nfs_client_list is not empty\n", net); >> + WARN(!list_empty(&nn->nfs_volume_list), >> + "net %p exit: nfs_volume_list is not empty\n", net); >> } >> > > Why do we need these? Is there a specific bug that you are trying to > track down? I hope such checks allows to detect leaked per-netns objects. Also I hope that all new pernet_operations will inherit such checks too. I assume that elements added into per-net lists should not live longer than net namespace, and should be deleted from the list. I think exit_net hook is good place for such check. Recently I've found lost list_entry and enabled timer on stop of net namespace. Then I've reviewed all existing pernet_operations and found that many drivers have such checks already. So I decided to complete this task and add such checks into all affected subsystems. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <297fee4f-3cef-9bd4-d683-a14559939b65-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>]
* Re: [PATCH 06/21] nfs client: exit_net cleanup check added [not found] ` <297fee4f-3cef-9bd4-d683-a14559939b65-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> @ 2017-11-05 18:55 ` Trond Myklebust 0 siblings, 0 replies; 4+ messages in thread From: Trond Myklebust @ 2017-11-05 18:55 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org Cc: anna.schumaker-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 2259 bytes --] On Sun, 2017-11-05 at 19:48 +0300, Vasily Averin wrote: > On 2017-11-05 19:02, Trond Myklebust wrote: > > On Sun, 2017-11-05 at 13:00 +0300, Vasily Averin wrote: > > > Be sure that nfs_client_list and nfs_volume_list lists > > > initialized > > > in net_init hook were return to initial state in net_exit hook. > > > > > > Signed-off-by: Vasily Averin <vvs@virtuozzo.com> > > > --- > > > fs/nfs/client.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/fs/nfs/client.c b/fs/nfs/client.c > > > index 22880ef..7c0691c 100644 > > > --- a/fs/nfs/client.c > > > +++ b/fs/nfs/client.c > > > @@ -204,6 +204,10 @@ void nfs_cleanup_cb_ident_idr(struct net > > > *net) > > > struct nfs_net *nn = net_generic(net, nfs_net_id); > > > > > > idr_destroy(&nn->cb_ident_idr); > > > + WARN(!list_empty(&nn->nfs_client_list), > > > + "net %p exit: nfs_client_list is not empty\n", > > > net); > > > + WARN(!list_empty(&nn->nfs_volume_list), > > > + "net %p exit: nfs_volume_list is not empty\n", > > > net); > > > } > > > > > > > Why do we need these? Is there a specific bug that you are trying > > to > > track down? > > I hope such checks allows to detect leaked per-netns objects. > Also I hope that all new pernet_operations will inherit such checks > too. > > I assume that elements added into per-net lists should not live > longer than net namespace, > and should be deleted from the list. I think exit_net hook is good > place for such check. > > Recently I've found lost list_entry and enabled timer on stop of net > namespace. > Then I've reviewed all existing pernet_operations and found that many > drivers > have such checks already. So I decided to complete this task and add > such checks > into all affected subsystems. > Unless there is a known problem that has specific debugging needs, this kind of assert should take the form of a WARN_ONCE() so that it doesn't fill user syslogs with redundant warnings if triggered. -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.myklebust@primarydata.com N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±û"Ø^nr¡ö¦zË\x1aëh¨èÚ&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br ê+Ê+zf£¢·h§~Ûiÿûàz¹\x1e®w¥¢¸?¨èÚ&¢)ߢ^[f ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-05 18:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-05 10:00 [PATCH 06/21] nfs client: exit_net cleanup check added Vasily Averin [not found] ` <5cbecaf0-dbb6-4140-43ed-ae94fc161941-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 2017-11-05 16:02 ` Trond Myklebust 2017-11-05 16:48 ` Vasily Averin [not found] ` <297fee4f-3cef-9bd4-d683-a14559939b65-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 2017-11-05 18:55 ` Trond Myklebust
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).