summaryrefslogtreecommitdiff
path: root/net/tipc/core.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 15:27:11 +0800
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:33 -0500
commita62fbccecd62bacb4416fc427239f5b43b25d05e (patch)
tree7f2646f08ce92d8d82cf4a6cbd2126e7f71555ec /net/tipc/core.c
parent347475395434abb2b61bf59c2952470f37072567 (diff)
tipc: make subscriber server support net namespace
TIPC establishes one subscriber server which allows users to subscribe their interesting name service status. After tipc supports namespace, one dedicated tipc stack instance is created for each namespace, and each instance can be deemed as one independent TIPC node. As a result, subscriber server must be built for each namespace. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/core.c')
-rw-r--r--net/tipc/core.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 7c09670120eb..4a8b7955e0e0 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -68,8 +68,14 @@ static int __net_init tipc_init_net(struct net *net)
err = tipc_nametbl_init(net);
if (err)
goto out_nametbl;
+
+ err = tipc_subscr_start(net);
+ if (err)
+ goto out_subscr;
return 0;
+out_subscr:
+ tipc_nametbl_stop(net);
out_nametbl:
tipc_sk_rht_destroy(net);
out_sk_rht:
@@ -78,6 +84,7 @@ out_sk_rht:
static void __net_exit tipc_exit_net(struct net *net)
{
+ tipc_subscr_stop(net);
tipc_net_stop(net);
tipc_nametbl_stop(net);
tipc_sk_rht_destroy(net);
@@ -104,10 +111,6 @@ static int __init tipc_init(void)
get_random_bytes(&tipc_random, sizeof(tipc_random));
- err = register_pernet_subsys(&tipc_net_ops);
- if (err)
- goto out_pernet;
-
err = tipc_netlink_start();
if (err)
goto out_netlink;
@@ -120,9 +123,9 @@ static int __init tipc_init(void)
if (err)
goto out_sysctl;
- err = tipc_subscr_start();
+ err = register_pernet_subsys(&tipc_net_ops);
if (err)
- goto out_subscr;
+ goto out_pernet;
err = tipc_bearer_setup();
if (err)
@@ -131,28 +134,25 @@ static int __init tipc_init(void)
pr_info("Started in single node mode\n");
return 0;
out_bearer:
- tipc_subscr_stop();
-out_subscr:
+ unregister_pernet_subsys(&tipc_net_ops);
+out_pernet:
tipc_unregister_sysctl();
out_sysctl:
tipc_socket_stop();
out_socket:
tipc_netlink_stop();
out_netlink:
- unregister_pernet_subsys(&tipc_net_ops);
-out_pernet:
pr_err("Unable to start in single node mode\n");
return err;
}
static void __exit tipc_exit(void)
{
- unregister_pernet_subsys(&tipc_net_ops);
tipc_bearer_cleanup();
tipc_netlink_stop();
- tipc_subscr_stop();
tipc_socket_stop();
tipc_unregister_sysctl();
+ unregister_pernet_subsys(&tipc_net_ops);
pr_info("Deactivated\n");
}