You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
ipvs: Pass ipvs not net to register_ip_vs_app and unregister_ip_vs_app
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>
This commit is contained in:
committed by
Simon Horman
parent
3250dc9c52
commit
9f8128a56e
+2
-2
@@ -1341,8 +1341,8 @@ void ip_vs_service_net_cleanup(struct netns_ipvs *ipvs);
|
|||||||
* (from ip_vs_app.c)
|
* (from ip_vs_app.c)
|
||||||
*/
|
*/
|
||||||
#define IP_VS_APP_MAX_PORTS 8
|
#define IP_VS_APP_MAX_PORTS 8
|
||||||
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);
|
||||||
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);
|
||||||
int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
|
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);
|
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,
|
int register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto,
|
||||||
|
|||||||
@@ -192,15 +192,11 @@ register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 pro
|
|||||||
|
|
||||||
|
|
||||||
/* Register application for netns */
|
/* 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;
|
struct ip_vs_app *a;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (!ipvs)
|
|
||||||
return ERR_PTR(-ENOENT);
|
|
||||||
|
|
||||||
mutex_lock(&__ip_vs_app_mutex);
|
mutex_lock(&__ip_vs_app_mutex);
|
||||||
|
|
||||||
list_for_each_entry(a, &ipvs->app_list, a_list) {
|
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
|
* We are sure there are no app incarnations attached to services
|
||||||
* Caller should use synchronize_rcu() or rcu_barrier()
|
* 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;
|
struct ip_vs_app *a, *anxt, *inc, *nxt;
|
||||||
|
struct net *net = ipvs->net;
|
||||||
if (!ipvs)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mutex_lock(&__ip_vs_app_mutex);
|
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)
|
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);
|
remove_proc_entry("ip_vs_app", net->proc_net);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
|
|||||||
if (!ipvs)
|
if (!ipvs)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
app = register_ip_vs_app(net, &ip_vs_ftp);
|
app = register_ip_vs_app(ipvs, &ip_vs_ftp);
|
||||||
if (IS_ERR(app))
|
if (IS_ERR(app))
|
||||||
return PTR_ERR(app);
|
return PTR_ERR(app);
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_unreg:
|
err_unreg:
|
||||||
unregister_ip_vs_app(net, &ip_vs_ftp);
|
unregister_ip_vs_app(ipvs, &ip_vs_ftp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -471,7 +471,12 @@ err_unreg:
|
|||||||
*/
|
*/
|
||||||
static void __ip_vs_ftp_exit(struct net *net)
|
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 = {
|
static struct pernet_operations ip_vs_ftp_ops = {
|
||||||
|
|||||||
Reference in New Issue
Block a user