]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: Convert pernet_subsys, registered from inet_init()
authorKirill Tkhai <ktkhai@virtuozzo.com>
Tue, 13 Feb 2018 09:29:52 +0000 (12:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Feb 2018 15:36:08 +0000 (10:36 -0500)
arp_net_ops just addr/removes /proc entry.

devinet_ops allocates and frees duplicate of init_net tables
and (un)registers sysctl entries.

fib_net_ops allocates and frees pernet tables, creates/destroys
netlink socket and (un)initializes /proc entries. Foreign
pernet_operations do not touch them.

ip_rt_proc_ops only modifies pernet /proc entries.

xfrm_net_ops creates/destroys /proc entries, allocates/frees
pernet statistics, hashes and tables, and (un)initializes
sysctl files. These are not touched by foreigh pernet_operations

xfrm4_net_ops allocates/frees private pernet memory, and
configures sysctls.

sysctl_route_ops creates/destroys sysctls.

rt_genid_ops only initializes fields of just allocated net.

ipv4_inetpeer_ops allocated/frees net private memory.

igmp_net_ops just creates/destroys /proc files and socket,
noone else interested in.

tcp_sk_ops seems to be safe, because tcp_sk_init() does not
depend on any other pernet_operations modifications. Iteration
over hash table in inet_twsk_purge() is made under RCU lock,
and it's safe to iterate the table this way. Removing from
the table happen from inet_twsk_deschedule_put(), but this
function is safe without any extern locks, as it's synchronized
inside itself. There are many examples, it's used in different
context. So, it's safe to leave tcp_sk_exit_batch() unlocked.

tcp_net_metrics_ops is synchronized on tcp_metrics_lock and safe.

udplite4_net_ops only creates/destroys pernet /proc file.

icmp_sk_ops creates percpu sockets, not touched by foreign
pernet_operations.

ipmr_net_ops creates/destroys pernet fib tables, (un)registers
fib rules and /proc files. This seem to be safe to execute
in parallel with foreign pernet_operations.

af_inet_ops just sets up default parameters of newly created net.

ipv4_mib_ops creates and destroys pernet percpu statistics.

raw_net_ops, tcp4_net_ops, udp4_net_ops, ping_v4_net_ops
and ip_proc_ops only create/destroy pernet /proc files.

ip4_frags_ops creates and destroys sysctl file.

So, it's safe to make the pernet_operations async.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
18 files changed:
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/ip_fragment.c
net/ipv4/ipmr.c
net/ipv4/ping.c
net/ipv4/proc.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_metrics.c
net/ipv4/udp.c
net/ipv4/udplite.c
net/ipv4/xfrm4_policy.c
net/xfrm/xfrm_policy.c

index f98e2f0db841b1ff9c75ab7cab2f7e95c0e20654..e8c7fad8c3290452ffa948da2a268f2e5d1b92f3 100644 (file)
@@ -1735,6 +1735,7 @@ static __net_exit void ipv4_mib_exit_net(struct net *net)
 static __net_initdata struct pernet_operations ipv4_mib_ops = {
        .init = ipv4_mib_init_net,
        .exit = ipv4_mib_exit_net,
+       .async = true,
 };
 
 static int __init init_ipv4_mibs(void)
@@ -1788,6 +1789,7 @@ static __net_exit void inet_exit_net(struct net *net)
 static __net_initdata struct pernet_operations af_inet_ops = {
        .init = inet_init_net,
        .exit = inet_exit_net,
+       .async = true,
 };
 
 static int __init init_inet_pernet_ops(void)
index f28f06c91eadc03446830357ae9bac332b8f60c9..7dc9de8444a909f8343b45efcc39082a2537ee98 100644 (file)
@@ -1447,6 +1447,7 @@ static void __net_exit arp_net_exit(struct net *net)
 static struct pernet_operations arp_net_ops = {
        .init = arp_net_init,
        .exit = arp_net_exit,
+       .async = true,
 };
 
 static int __init arp_proc_init(void)
index 40f001782c1b37314ecd197ab65cb3adc68f50c7..5ae0d1f097ca591c208af33e63d1fe1975ba0ab5 100644 (file)
@@ -2469,6 +2469,7 @@ static __net_exit void devinet_exit_net(struct net *net)
 static __net_initdata struct pernet_operations devinet_ops = {
        .init = devinet_init_net,
        .exit = devinet_exit_net,
+       .async = true,
 };
 
 static struct rtnl_af_ops inet_af_ops __read_mostly = {
index f05afaf3235c0500a9087eae6365b7001aa64663..ac71c3d496c02d385eeb48506175b0d627b8580d 100644 (file)
@@ -1362,6 +1362,7 @@ static void __net_exit fib_net_exit(struct net *net)
 static struct pernet_operations fib_net_ops = {
        .init = fib_net_init,
        .exit = fib_net_exit,
+       .async = true,
 };
 
 void __init ip_fib_init(void)
index 1617604c92847d5b0d058fac40dc3707f22348a5..cc56efa64d5cca59f5ce2db91f83ce60da52ed36 100644 (file)
@@ -1257,6 +1257,7 @@ static int __net_init icmp_sk_init(struct net *net)
 static struct pernet_operations __net_initdata icmp_sk_ops = {
        .init = icmp_sk_init,
        .exit = icmp_sk_exit,
+       .async = true,
 };
 
 int __init icmp_init(void)
index f2402581fef1b559c0952e142a682d596d4be5b5..c2743763777e4ebcadd569c677c1ebdc80405f01 100644 (file)
@@ -3028,6 +3028,7 @@ static void __net_exit igmp_net_exit(struct net *net)
 static struct pernet_operations igmp_net_ops = {
        .init = igmp_net_init,
        .exit = igmp_net_exit,
+       .async = true,
 };
 #endif
 
index bbf1b94942c0ed53d1ddb87e4ee63833c08f2684..5e843ae5e468ee78afdb00db84caac29469856d2 100644 (file)
@@ -885,6 +885,7 @@ static void __net_exit ipv4_frags_exit_net(struct net *net)
 static struct pernet_operations ip4_frags_ops = {
        .init = ipv4_frags_init_net,
        .exit = ipv4_frags_exit_net,
+       .async = true,
 };
 
 void __init ipfrag_init(void)
index b05689bbba311d0e8d1b2f30f3c8766e0f28e553..7c7ac9d32e77961a4fa7b5a4a05fe785b6a6810d 100644 (file)
@@ -3327,6 +3327,7 @@ static void __net_exit ipmr_net_exit(struct net *net)
 static struct pernet_operations ipmr_net_ops = {
        .init = ipmr_net_init,
        .exit = ipmr_net_exit,
+       .async = true,
 };
 
 int __init ip_mr_init(void)
index b8f0db54b1978c800c1f606e0d06a015499a2972..0164def9c80847560a29811022eec453d58eeab0 100644 (file)
@@ -1204,6 +1204,7 @@ static void __net_exit ping_v4_proc_exit_net(struct net *net)
 static struct pernet_operations ping_v4_net_ops = {
        .init = ping_v4_proc_init_net,
        .exit = ping_v4_proc_exit_net,
+       .async = true,
 };
 
 int __init ping_proc_init(void)
index dc5edc8f7564d15634fc5528896bb83f1e1ea009..fdabc70283b646fe496a87228f380493eb8fd8ee 100644 (file)
@@ -549,6 +549,7 @@ static __net_exit void ip_proc_exit_net(struct net *net)
 static __net_initdata struct pernet_operations ip_proc_ops = {
        .init = ip_proc_init_net,
        .exit = ip_proc_exit_net,
+       .async = true,
 };
 
 int __init ip_misc_proc_init(void)
index 9b367fc48d7dde553ae5972481d813c7d313ddb9..54648d20bf0f87e1b9a2cceb7bb18a31c8df319a 100644 (file)
@@ -1156,6 +1156,7 @@ static __net_exit void raw_exit_net(struct net *net)
 static __net_initdata struct pernet_operations raw_net_ops = {
        .init = raw_init_net,
        .exit = raw_exit_net,
+       .async = true,
 };
 
 int __init raw_proc_init(void)
index 49cc1c1df1bac0c9046f8d34db02c4bef18079e4..9376ed69ffeb50a1bd6b1c6c0497d42b75f854d1 100644 (file)
@@ -417,6 +417,7 @@ static void __net_exit ip_rt_do_proc_exit(struct net *net)
 static struct pernet_operations ip_rt_proc_ops __net_initdata =  {
        .init = ip_rt_do_proc_init,
        .exit = ip_rt_do_proc_exit,
+       .async = true,
 };
 
 static int __init ip_rt_proc_init(void)
@@ -2994,6 +2995,7 @@ static __net_exit void sysctl_route_net_exit(struct net *net)
 static __net_initdata struct pernet_operations sysctl_route_ops = {
        .init = sysctl_route_net_init,
        .exit = sysctl_route_net_exit,
+       .async = true,
 };
 #endif
 
@@ -3007,6 +3009,7 @@ static __net_init int rt_genid_init(struct net *net)
 
 static __net_initdata struct pernet_operations rt_genid_ops = {
        .init = rt_genid_init,
+       .async = true,
 };
 
 static int __net_init ipv4_inetpeer_init(struct net *net)
@@ -3032,6 +3035,7 @@ static void __net_exit ipv4_inetpeer_exit(struct net *net)
 static __net_initdata struct pernet_operations ipv4_inetpeer_ops = {
        .init   =       ipv4_inetpeer_init,
        .exit   =       ipv4_inetpeer_exit,
+       .async  =       true,
 };
 
 #ifdef CONFIG_IP_ROUTE_CLASSID
index f8ad397e285e9b8db0b04f8abc30a42f22294ef9..ac16795486ea8678676e52bfc41ee240aabea0b3 100644 (file)
@@ -2387,6 +2387,7 @@ static void __net_exit tcp4_proc_exit_net(struct net *net)
 static struct pernet_operations tcp4_net_ops = {
        .init = tcp4_proc_init_net,
        .exit = tcp4_proc_exit_net,
+       .async = true,
 };
 
 int __init tcp4_proc_init(void)
@@ -2573,6 +2574,7 @@ static struct pernet_operations __net_initdata tcp_sk_ops = {
        .init      = tcp_sk_init,
        .exit      = tcp_sk_exit,
        .exit_batch = tcp_sk_exit_batch,
+       .async     = true,
 };
 
 void __init tcp_v4_init(void)
index 03b51cdcc731f5d85cbe51337f864bc8abc40135..aa6fea9f332844450cb474f2bd0ba58103304656 100644 (file)
@@ -1024,6 +1024,7 @@ static void __net_exit tcp_net_metrics_exit_batch(struct list_head *net_exit_lis
 static __net_initdata struct pernet_operations tcp_net_metrics_ops = {
        .init           =       tcp_net_metrics_init,
        .exit_batch     =       tcp_net_metrics_exit_batch,
+       .async          =       true,
 };
 
 void __init tcp_metrics_init(void)
index bfaefe560b5ce32bbf383469d8f77795d1322ed9..ac5fac0e59b1ee56a4e141b6c44420c200700a46 100644 (file)
@@ -2757,6 +2757,7 @@ static void __net_exit udp4_proc_exit_net(struct net *net)
 static struct pernet_operations udp4_net_ops = {
        .init = udp4_proc_init_net,
        .exit = udp4_proc_exit_net,
+       .async = true,
 };
 
 int __init udp4_proc_init(void)
index f96614e9b9a5d866e6ed01f7624f097c408a84ce..72f2c3806408c78650a51a1dbb54304eab68be3b 100644 (file)
@@ -104,6 +104,7 @@ static void __net_exit udplite4_proc_exit_net(struct net *net)
 static struct pernet_operations udplite4_net_ops = {
        .init = udplite4_proc_init_net,
        .exit = udplite4_proc_exit_net,
+       .async = true,
 };
 
 static __init int udplite4_proc_init(void)
index 05017e2c849c12b43715fe4944759a3c91880ee8..753f526cf9dbe339a977afb7d1ec11711e19764a 100644 (file)
@@ -365,6 +365,7 @@ static void __net_exit xfrm4_net_exit(struct net *net)
 static struct pernet_operations __net_initdata xfrm4_net_ops = {
        .init   = xfrm4_net_init,
        .exit   = xfrm4_net_exit,
+       .async  = true,
 };
 
 static void __init xfrm4_policy_init(void)
index 7a23078132cf523e83a489d61222bc44f5394c4c..77d9d1ab05ce17838dba0322a0e222add2ed1dc2 100644 (file)
@@ -2982,6 +2982,7 @@ static void __net_exit xfrm_net_exit(struct net *net)
 static struct pernet_operations __net_initdata xfrm_net_ops = {
        .init = xfrm_net_init,
        .exit = xfrm_net_exit,
+       .async = true,
 };
 
 void __init xfrm_init(void)