ipvs: Pass ipvs not net to register_ip_vs_app and unregister_ip_vs_app
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 21 Sep 2015 18:02:32 +0000 (13:02 -0500)
committerSimon Horman <horms@verge.net.au>
Thu, 24 Sep 2015 00:34:40 +0000 (09:34 +0900)
Also move the tests for net_ipvs being NULL into __ip_vs_ftp_init
and __ip_vs_ftp_exit.  The only places where they possibly make
sense.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
include/net/ip_vs.h
net/netfilter/ipvs/ip_vs_app.c
net/netfilter/ipvs/ip_vs_ftp.c

index c06bad39958d02f4fceeb877af5b1e4c6813fd5b..5caafed5af2e22bd292cf5c3ed509bad96e3ce29 100644 (file)
@@ -1341,8 +1341,8 @@ void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs);
  * (from ip_vs_app.c)
  */
 #define IP_VS_APP_MAX_PORTS  8
-struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
-void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
+struct ip_vs_app *register_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app);
+void unregister_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app);
 int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
 void ip_vs_unbind_app(struct ip_vs_conn *cp);
 int register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto,
index 20cb947a3ddd5615936e14ae6e01084a6ff53aaa..a0cc08337a2ca8364d4748fecd5f784930933fde 100644 (file)
@@ -192,15 +192,11 @@ register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 pro
 
 
 /* Register application for netns */
-struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app)
+struct ip_vs_app *register_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        struct ip_vs_app *a;
        int err = 0;
 
-       if (!ipvs)
-               return ERR_PTR(-ENOENT);
-
        mutex_lock(&__ip_vs_app_mutex);
 
        list_for_each_entry(a, &ipvs->app_list, a_list) {
@@ -231,13 +227,10 @@ out_unlock:
  *     We are sure there are no app incarnations attached to services
  *     Caller should use synchronize_rcu() or rcu_barrier()
  */
-void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app)
+void unregister_ip_vs_app(struct netns_ipvs *ipvs, struct ip_vs_app *app)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        struct ip_vs_app *a, *anxt, *inc, *nxt;
-
-       if (!ipvs)
-               return;
+       struct net *net = ipvs->net;
 
        mutex_lock(&__ip_vs_app_mutex);
 
@@ -623,6 +616,8 @@ int __net_init ip_vs_app_net_init(struct net *net)
 
 void __net_exit ip_vs_app_net_cleanup(struct net *net)
 {
-       unregister_ip_vs_app(net, NULL /* all */);
+       struct netns_ipvs *ipvs = net_ipvs(net);
+
+       unregister_ip_vs_app(ipvs, NULL /* all */);
        remove_proc_entry("ip_vs_app", net->proc_net);
 }
index 24bab8e5a507565965483539de7117ecd883fcf6..508544aff36d1729876d63828bf2ef83f3178ecf 100644 (file)
@@ -447,7 +447,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
        if (!ipvs)
                return -ENOENT;
 
-       app = register_ip_vs_app(net, &ip_vs_ftp);
+       app = register_ip_vs_app(ipvs, &ip_vs_ftp);
        if (IS_ERR(app))
                return PTR_ERR(app);
 
@@ -463,7 +463,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
        return 0;
 
 err_unreg:
-       unregister_ip_vs_app(net, &ip_vs_ftp);
+       unregister_ip_vs_app(ipvs, &ip_vs_ftp);
        return ret;
 }
 /*
@@ -471,7 +471,12 @@ err_unreg:
  */
 static void __ip_vs_ftp_exit(struct net *net)
 {
-       unregister_ip_vs_app(net, &ip_vs_ftp);
+       struct netns_ipvs *ipvs = net_ipvs(net);
+
+       if (!ipvs)
+               return;
+
+       unregister_ip_vs_app(ipvs, &ip_vs_ftp);
 }
 
 static struct pernet_operations ip_vs_ftp_ops = {
This page took 0.028396 seconds and 5 git commands to generate.