* [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
@ 2012-04-26 5:47 ` Hans Schillstrom
0 siblings, 0 replies; 6+ messages in thread
From: Hans Schillstrom @ 2012-04-26 5:47 UTC (permalink / raw)
To: horms, ja, wensong, brouer, rohara, lvs-devel, netdev, netfilter-devel
Cc: hans, Hans Schillstrom
Change order of init so netns init is ready
when register ioctl and netlink.
Ver2
Whitespace fixes and __init added.
Reported-by: "Ryan O'Hara" <rohara@redhat.com>
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
---
include/net/ip_vs.h | 2 +
net/netfilter/ipvs/ip_vs_core.c | 9 ++++++
net/netfilter/ipvs/ip_vs_ctl.c | 52 ++++++++++++++++++++++----------------
3 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index f967395..93b81aa 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1201,6 +1201,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
extern int ip_vs_use_count_inc(void);
extern void ip_vs_use_count_dec(void);
+extern int ip_vs_register_nl_ioctl(void);
+extern void ip_vs_unregister_nl_ioctl(void);
extern int ip_vs_control_init(void);
extern void ip_vs_control_cleanup(void);
extern struct ip_vs_dest *
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index d8b1d30..c8f36b9 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1995,10 +1995,18 @@ static int __init ip_vs_init(void)
goto cleanup_dev;
}
+ ret = ip_vs_register_nl_ioctl();
+ if (ret < 0) {
+ pr_err("can't register netlink/ioctl.\n");
+ goto cleanup_hooks;
+ }
+
pr_info("ipvs loaded.\n");
return ret;
+cleanup_hooks:
+ nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
cleanup_dev:
unregister_pernet_device(&ipvs_core_dev_ops);
cleanup_sub:
@@ -2014,6 +2022,7 @@ exit:
static void __exit ip_vs_cleanup(void)
{
+ ip_vs_unregister_nl_ioctl();
nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
unregister_pernet_device(&ipvs_core_dev_ops);
unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 7131417..efaf484 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
free_percpu(ipvs->tot_stats.cpustats);
}
-int __init ip_vs_control_init(void)
+int __init ip_vs_register_nl_ioctl(void)
{
- int idx;
int ret;
- EnterFunction(2);
-
- /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
- for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
- INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
- INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
- }
-
- smp_wmb(); /* Do we really need it now ? */
-
ret = nf_register_sockopt(&ip_vs_sockopts);
if (ret) {
pr_err("cannot register sockopt.\n");
@@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void)
pr_err("cannot register Generic Netlink interface.\n");
goto err_genl;
}
-
- ret = register_netdevice_notifier(&ip_vs_dst_notifier);
- if (ret < 0)
- goto err_notf;
-
- LeaveFunction(2);
return 0;
-err_notf:
- ip_vs_genl_unregister();
err_genl:
nf_unregister_sockopt(&ip_vs_sockopts);
err_sock:
return ret;
}
+void ip_vs_unregister_nl_ioctl(void)
+{
+ ip_vs_genl_unregister();
+ nf_unregister_sockopt(&ip_vs_sockopts);
+}
+
+int __init ip_vs_control_init(void)
+{
+ int idx;
+ int ret;
+
+ EnterFunction(2);
+
+ /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
+ for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
+ INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
+ INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
+ }
+
+ smp_wmb(); /* Do we really need it now ? */
+
+ ret = register_netdevice_notifier(&ip_vs_dst_notifier);
+ if (ret < 0)
+ return ret;
+
+ LeaveFunction(2);
+ return 0;
+}
+
void ip_vs_control_cleanup(void)
{
EnterFunction(2);
unregister_netdevice_notifier(&ip_vs_dst_notifier);
- ip_vs_genl_unregister();
- nf_unregister_sockopt(&ip_vs_sockopts);
LeaveFunction(2);
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
@ 2012-04-26 5:47 ` Hans Schillstrom
0 siblings, 0 replies; 6+ messages in thread
From: Hans Schillstrom @ 2012-04-26 5:47 UTC (permalink / raw)
To: horms, ja, wensong, brouer, rohara, lvs-devel, netdev, netfilter-devel
Cc: hans, Hans Schillstrom
Change order of init so netns init is ready
when register ioctl and netlink.
Ver2
Whitespace fixes and __init added.
Reported-by: "Ryan O'Hara" <rohara@redhat.com>
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
---
include/net/ip_vs.h | 2 +
net/netfilter/ipvs/ip_vs_core.c | 9 ++++++
net/netfilter/ipvs/ip_vs_ctl.c | 52 ++++++++++++++++++++++----------------
3 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index f967395..93b81aa 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1201,6 +1201,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
extern int ip_vs_use_count_inc(void);
extern void ip_vs_use_count_dec(void);
+extern int ip_vs_register_nl_ioctl(void);
+extern void ip_vs_unregister_nl_ioctl(void);
extern int ip_vs_control_init(void);
extern void ip_vs_control_cleanup(void);
extern struct ip_vs_dest *
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index d8b1d30..c8f36b9 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1995,10 +1995,18 @@ static int __init ip_vs_init(void)
goto cleanup_dev;
}
+ ret = ip_vs_register_nl_ioctl();
+ if (ret < 0) {
+ pr_err("can't register netlink/ioctl.\n");
+ goto cleanup_hooks;
+ }
+
pr_info("ipvs loaded.\n");
return ret;
+cleanup_hooks:
+ nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
cleanup_dev:
unregister_pernet_device(&ipvs_core_dev_ops);
cleanup_sub:
@@ -2014,6 +2022,7 @@ exit:
static void __exit ip_vs_cleanup(void)
{
+ ip_vs_unregister_nl_ioctl();
nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
unregister_pernet_device(&ipvs_core_dev_ops);
unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 7131417..efaf484 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
free_percpu(ipvs->tot_stats.cpustats);
}
-int __init ip_vs_control_init(void)
+int __init ip_vs_register_nl_ioctl(void)
{
- int idx;
int ret;
- EnterFunction(2);
-
- /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
- for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
- INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
- INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
- }
-
- smp_wmb(); /* Do we really need it now ? */
-
ret = nf_register_sockopt(&ip_vs_sockopts);
if (ret) {
pr_err("cannot register sockopt.\n");
@@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void)
pr_err("cannot register Generic Netlink interface.\n");
goto err_genl;
}
-
- ret = register_netdevice_notifier(&ip_vs_dst_notifier);
- if (ret < 0)
- goto err_notf;
-
- LeaveFunction(2);
return 0;
-err_notf:
- ip_vs_genl_unregister();
err_genl:
nf_unregister_sockopt(&ip_vs_sockopts);
err_sock:
return ret;
}
+void ip_vs_unregister_nl_ioctl(void)
+{
+ ip_vs_genl_unregister();
+ nf_unregister_sockopt(&ip_vs_sockopts);
+}
+
+int __init ip_vs_control_init(void)
+{
+ int idx;
+ int ret;
+
+ EnterFunction(2);
+
+ /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
+ for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
+ INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
+ INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
+ }
+
+ smp_wmb(); /* Do we really need it now ? */
+
+ ret = register_netdevice_notifier(&ip_vs_dst_notifier);
+ if (ret < 0)
+ return ret;
+
+ LeaveFunction(2);
+ return 0;
+}
+
void ip_vs_control_cleanup(void)
{
EnterFunction(2);
unregister_netdevice_notifier(&ip_vs_dst_notifier);
- ip_vs_genl_unregister();
- nf_unregister_sockopt(&ip_vs_sockopts);
LeaveFunction(2);
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
2012-04-26 5:47 ` Hans Schillstrom
(?)
@ 2012-04-26 8:10 ` Jesper Dangaard Brouer
2012-04-26 9:05 ` Simon Horman
-1 siblings, 1 reply; 6+ messages in thread
From: Jesper Dangaard Brouer @ 2012-04-26 8:10 UTC (permalink / raw)
To: Hans Schillstrom
Cc: horms, ja, wensong, rohara, lvs-devel, netdev, netfilter-devel, hans
On Thu, 2012-04-26 at 07:47 +0200, Hans Schillstrom wrote:
> Change order of init so netns init is ready
> when register ioctl and netlink.
>
> Ver2
> Whitespace fixes and __init added.
>
> Reported-by: "Ryan O'Hara" <rohara@redhat.com>
> Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Looks good, interdiff says you fixed up things, and I have tested it
against the net tree, good work :-)
Is this a stable tree candidate?
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
2012-04-26 5:47 ` Hans Schillstrom
(?)
(?)
@ 2012-04-26 8:11 ` Julian Anastasov
-1 siblings, 0 replies; 6+ messages in thread
From: Julian Anastasov @ 2012-04-26 8:11 UTC (permalink / raw)
To: Hans Schillstrom
Cc: horms, wensong, brouer, rohara, lvs-devel, netdev, netfilter-devel, hans
Hello,
On Thu, 26 Apr 2012, Hans Schillstrom wrote:
> Change order of init so netns init is ready
> when register ioctl and netlink.
>
> Ver2
> Whitespace fixes and __init added.
>
> Reported-by: "Ryan O'Hara" <rohara@redhat.com>
> Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
> ---
> include/net/ip_vs.h | 2 +
> net/netfilter/ipvs/ip_vs_core.c | 9 ++++++
> net/netfilter/ipvs/ip_vs_ctl.c | 52 ++++++++++++++++++++++----------------
> 3 files changed, 41 insertions(+), 22 deletions(-)
>
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index f967395..93b81aa 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -1201,6 +1201,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
>
> extern int ip_vs_use_count_inc(void);
> extern void ip_vs_use_count_dec(void);
> +extern int ip_vs_register_nl_ioctl(void);
> +extern void ip_vs_unregister_nl_ioctl(void);
> extern int ip_vs_control_init(void);
> extern void ip_vs_control_cleanup(void);
> extern struct ip_vs_dest *
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index d8b1d30..c8f36b9 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1995,10 +1995,18 @@ static int __init ip_vs_init(void)
> goto cleanup_dev;
> }
>
> + ret = ip_vs_register_nl_ioctl();
> + if (ret < 0) {
> + pr_err("can't register netlink/ioctl.\n");
> + goto cleanup_hooks;
> + }
> +
> pr_info("ipvs loaded.\n");
>
> return ret;
>
> +cleanup_hooks:
> + nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
> cleanup_dev:
> unregister_pernet_device(&ipvs_core_dev_ops);
> cleanup_sub:
> @@ -2014,6 +2022,7 @@ exit:
>
> static void __exit ip_vs_cleanup(void)
> {
> + ip_vs_unregister_nl_ioctl();
> nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops));
> unregister_pernet_device(&ipvs_core_dev_ops);
> unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 7131417..efaf484 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
> free_percpu(ipvs->tot_stats.cpustats);
> }
>
> -int __init ip_vs_control_init(void)
> +int __init ip_vs_register_nl_ioctl(void)
> {
> - int idx;
> int ret;
>
> - EnterFunction(2);
> -
> - /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
> - for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
> - INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
> - INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
> - }
> -
> - smp_wmb(); /* Do we really need it now ? */
> -
> ret = nf_register_sockopt(&ip_vs_sockopts);
> if (ret) {
> pr_err("cannot register sockopt.\n");
> @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void)
> pr_err("cannot register Generic Netlink interface.\n");
> goto err_genl;
> }
> -
> - ret = register_netdevice_notifier(&ip_vs_dst_notifier);
> - if (ret < 0)
> - goto err_notf;
> -
> - LeaveFunction(2);
> return 0;
>
> -err_notf:
> - ip_vs_genl_unregister();
> err_genl:
> nf_unregister_sockopt(&ip_vs_sockopts);
> err_sock:
> return ret;
> }
>
> +void ip_vs_unregister_nl_ioctl(void)
> +{
> + ip_vs_genl_unregister();
> + nf_unregister_sockopt(&ip_vs_sockopts);
> +}
> +
> +int __init ip_vs_control_init(void)
> +{
> + int idx;
> + int ret;
> +
> + EnterFunction(2);
> +
> + /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */
> + for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
> + INIT_LIST_HEAD(&ip_vs_svc_table[idx]);
> + INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]);
> + }
> +
> + smp_wmb(); /* Do we really need it now ? */
> +
> + ret = register_netdevice_notifier(&ip_vs_dst_notifier);
> + if (ret < 0)
> + return ret;
> +
> + LeaveFunction(2);
> + return 0;
> +}
> +
>
> void ip_vs_control_cleanup(void)
> {
> EnterFunction(2);
> unregister_netdevice_notifier(&ip_vs_dst_notifier);
> - ip_vs_genl_unregister();
> - nf_unregister_sockopt(&ip_vs_sockopts);
> LeaveFunction(2);
> }
> --
> 1.7.2.3
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
2012-04-26 8:10 ` Jesper Dangaard Brouer
@ 2012-04-26 9:05 ` Simon Horman
2012-04-26 15:26 ` Pablo Neira Ayuso
0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2012-04-26 9:05 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Hans Schillstrom, ja, wensong, rohara, lvs-devel, netdev,
netfilter-devel, hans
On Thu, Apr 26, 2012 at 10:10:41AM +0200, Jesper Dangaard Brouer wrote:
> On Thu, 2012-04-26 at 07:47 +0200, Hans Schillstrom wrote:
> > Change order of init so netns init is ready
> > when register ioctl and netlink.
> >
> > Ver2
> > Whitespace fixes and __init added.
> >
> > Reported-by: "Ryan O'Hara" <rohara@redhat.com>
> > Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
>
> Looks good, interdiff says you fixed up things, and I have tested it
> against the net tree, good work :-)
>
> Is this a stable tree candidate?
Yes, I think so.
I now have the following 7 changes in my ipvs tree on kernel.org.
The last two are already in Pablo's net tree and I intend
to send a pull request for the remaining 5 soon.
It is my opinion that all 7 patches are stable tree material.
ipvs: kernel oops - do_ip_vs_get_ctl
ipvs: take care of return value from protocol init_netns
ipvs: null check of net->ipvs in lblc(r) shedulers
ipvs: reset ipvs pointer in netns
ipvs: add check in ftp for initialized core
ipvs: fix crash in ip_vs_control_net_cleanup on unload
ipvs: Verify that IP_VS protocol has been registered
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl
2012-04-26 9:05 ` Simon Horman
@ 2012-04-26 15:26 ` Pablo Neira Ayuso
0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-26 15:26 UTC (permalink / raw)
To: Simon Horman
Cc: Jesper Dangaard Brouer, Hans Schillstrom, ja, wensong, rohara,
lvs-devel, netdev, netfilter-devel, hans
On Thu, Apr 26, 2012 at 06:05:20PM +0900, Simon Horman wrote:
> On Thu, Apr 26, 2012 at 10:10:41AM +0200, Jesper Dangaard Brouer wrote:
> > On Thu, 2012-04-26 at 07:47 +0200, Hans Schillstrom wrote:
> > > Change order of init so netns init is ready
> > > when register ioctl and netlink.
> > >
> > > Ver2
> > > Whitespace fixes and __init added.
> > >
> > > Reported-by: "Ryan O'Hara" <rohara@redhat.com>
> > > Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
> >
> > Looks good, interdiff says you fixed up things, and I have tested it
> > against the net tree, good work :-)
> >
> > Is this a stable tree candidate?
>
> Yes, I think so.
>
> I now have the following 7 changes in my ipvs tree on kernel.org.
>
> The last two are already in Pablo's net tree and I intend
> to send a pull request for the remaining 5 soon.
OK, then I'll wait for that pull request to pass these 7 patch batch
to davem if you make it anytime soon.
> It is my opinion that all 7 patches are stable tree material.
Little reminder: We can ask for this once they have hit Linus' tree.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-26 15:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 5:47 [v2 PATCH 1/1] ipvs: kernel oops - do_ip_vs_get_ctl Hans Schillstrom
2012-04-26 5:47 ` Hans Schillstrom
2012-04-26 8:10 ` Jesper Dangaard Brouer
2012-04-26 9:05 ` Simon Horman
2012-04-26 15:26 ` Pablo Neira Ayuso
2012-04-26 8:11 ` Julian Anastasov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.