* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook
@ 2017-11-07 12:26 Alexey Dobriyan
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2017-11-07 12:26 UTC (permalink / raw)
To: vvs; +Cc: netdev, davem
> - BUG_ON(!list_empty(grace_list));
> + WARN_ONCE(!list_empty(grace_list),
> + "net %x %s: grace_list is not empty\n",
> + net->ns.inum, __func__);
* printing __func__ is unnecessary as it will be on top of the stacktrace anyway,
* message duplicates condition
* printing netns id in netns ->exit hook also looks like pointless
information: for kernel dumps you want struct net pointer right away.
You wrote admins want to know which container triggered the message
but what will they do with that information?
I'd say WARN_ONCE(!list_empty()) is enough.
BUG_ON if you ship with crashdumps by default.
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 00/21] exit_net checks for objects initialized in net_init hook
@ 2017-11-05 16:49 Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Vasily Averin @ 2017-11-05 16:49 UTC (permalink / raw)
To: netdev
This patch set checks that lists initialized in net_init hooks were
return to initial state at end of net_exit hooks.
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.
v2:
- net pointer removed from output
- fixed compilation for phonet driver
Vasily Averin (21):
exit_net cleanup: geneve sock_list check
ppp: exit_net cleanup checks added
vxlan: exit_net cleanup checks added
netdev: exit_net cleanup check added
nfs4blocklayout: exit_net cleanup check added
nfs client: exit_net cleanup check added
fib_notifier: exit_net cleanup check added
fib_rules: exit_net cleanup check added
clusterip: exit_net cleanup check added
xfrm6_tunnel: exit_net cleanup check added
af_key: replace BUG_ON on WARN_ON in net_exit hook
l2tp: exit_net cleanup check added
nf_tables: exit_net cleanup check added
nfnetlink_log: exit_net cleanup check added
nfnetlink_gueue: exit_net cleanup check added
x_tables: exit_net cleanup check added
hashlimit: exit_net cleanup check added
recent: exit_net cleanup check added
packet: exit_net cleanup check added
phonet: exit_net cleanup check added
sunrpc: exit_net cleanup check added
drivers/net/geneve.c | 2 ++
drivers/net/ppp/ppp_generic.c | 4 ++++
drivers/net/vxlan.c | 6 ++++++
fs/nfs/blocklayout/rpc_pipefs.c | 2 ++
fs/nfs/client.c | 4 ++++
net/core/dev.c | 3 +++
net/core/fib_notifier.c | 7 +++++++
net/core/fib_rules.c | 7 +++++++
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 ++
net/ipv6/xfrm6_tunnel.c | 12 ++++++++++++
net/key/af_key.c | 2 +-
net/l2tp/l2tp_core.c | 6 ++++++
net/netfilter/nf_tables_api.c | 9 +++++++++
net/netfilter/nfnetlink_log.c | 6 ++++++
net/netfilter/nfnetlink_queue.c | 7 +++++++
net/netfilter/x_tables.c | 10 ++++++++++
net/netfilter/xt_hashlimit.c | 4 ++++
net/netfilter/xt_recent.c | 4 ++++
net/packet/af_packet.c | 2 ++
net/phonet/pn_dev.c | 4 ++++
net/sunrpc/sunrpc_syms.c | 4 ++++
21 files changed, 106 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>]
* [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook [not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> @ 2017-11-06 13:22 ` Vasily Averin 2017-11-06 20:02 ` J. Bruce Fields [not found] ` <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 0 siblings, 2 replies; 4+ messages in thread From: Vasily Averin @ 2017-11-06 13:22 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA Cc: J. Bruce Fields, Jeff Layton, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> --- fs/nfs_common/grace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c index 420d3a0..1bd6599 100644 --- a/fs/nfs_common/grace.c +++ b/fs/nfs_common/grace.c @@ -104,7 +104,9 @@ grace_exit_net(struct net *net) { struct list_head *grace_list = net_generic(net, grace_net_id); - BUG_ON(!list_empty(grace_list)); + WARN_ONCE(!list_empty(grace_list), + "net %x %s: grace_list is not empty\n", + net->ns.inum, __func__); } static struct pernet_operations grace_net_ops = { -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook 2017-11-06 13:22 ` [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook Vasily Averin @ 2017-11-06 20:02 ` J. Bruce Fields [not found] ` <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> 1 sibling, 0 replies; 4+ messages in thread From: J. Bruce Fields @ 2017-11-06 20:02 UTC (permalink / raw) To: Vasily Averin; +Cc: netdev, Jeff Layton, linux-nfs@vger.kernel.org I'm assuming you want me to apply this (and the following lockd patch), but I'm not clear why this is part of a bigger series going to netdev. --b. On Mon, Nov 06, 2017 at 04:22:48PM +0300, Vasily Averin wrote: > Signed-off-by: Vasily Averin <vvs@virtuozzo.com> > --- > fs/nfs_common/grace.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c > index 420d3a0..1bd6599 100644 > --- a/fs/nfs_common/grace.c > +++ b/fs/nfs_common/grace.c > @@ -104,7 +104,9 @@ grace_exit_net(struct net *net) > { > struct list_head *grace_list = net_generic(net, grace_net_id); > > - BUG_ON(!list_empty(grace_list)); > + WARN_ONCE(!list_empty(grace_list), > + "net %x %s: grace_list is not empty\n", > + net->ns.inum, __func__); > } > > static struct pernet_operations grace_net_ops = { > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>]
* Re: [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook [not found] ` <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> @ 2017-11-09 15:06 ` J. Bruce Fields 0 siblings, 0 replies; 4+ messages in thread From: J. Bruce Fields @ 2017-11-09 15:06 UTC (permalink / raw) To: Vasily Averin Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Jeff Layton, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Applied for 4.15, thanks.--b. On Mon, Nov 06, 2017 at 04:22:48PM +0300, Vasily Averin wrote: > Signed-off-by: Vasily Averin <vvs-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org> > --- > fs/nfs_common/grace.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c > index 420d3a0..1bd6599 100644 > --- a/fs/nfs_common/grace.c > +++ b/fs/nfs_common/grace.c > @@ -104,7 +104,9 @@ grace_exit_net(struct net *net) > { > struct list_head *grace_list = net_generic(net, grace_net_id); > > - BUG_ON(!list_empty(grace_list)); > + WARN_ONCE(!list_empty(grace_list), > + "net %x %s: grace_list is not empty\n", > + net->ns.inum, __func__); > } > > static struct pernet_operations grace_net_ops = { > -- > 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-09 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 12:26 [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook Alexey Dobriyan
-- strict thread matches above, loose matches on Subject: below --
2017-11-05 16:49 [PATCH v2 00/21] exit_net checks for objects initialized in net_init hook Vasily Averin
[not found] ` <4fdc4264-e338-6ee8-a662-7d98b45733a1-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-06 13:22 ` [PATCH v3 01/21] grace: replace BUG_ON by WARN_ONCE in exit_net hook Vasily Averin
2017-11-06 20:02 ` J. Bruce Fields
[not found] ` <a059abdd-e727-adcb-7b43-976be1d0a08e-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-11-09 15:06 ` J. Bruce Fields
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox