]> git.baikalelectronics.ru Git - kernel.git/commit
net: Assign net to net_namespace_list in setup_net()
authorKirill Tkhai <ktkhai@virtuozzo.com>
Tue, 13 Feb 2018 09:26:02 +0000 (12:26 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Feb 2018 15:36:04 +0000 (10:36 -0500)
commit705fdc4101c06d7d4dd09d60cb1d41e7fdf9cf10
tree898d5c235f2f626962c567f84942d7463cdfe825
parenteec0c9b0d297c9a01ded71ef6a0364120ca3f9aa
net: Assign net to net_namespace_list in setup_net()

This patch merges two repeating pieces of code in one,
and they will live in setup_net() now.

The only change is that assignment:

init_net_initialized = true;

becomes reordered with:

list_add_tail_rcu(&net->list, &net_namespace_list);

The order does not have visible effect, and it is a simple
cleanup because of:

init_net_initialized is used in !CONFIG_NET_NS case
to order proc_net_ns_ops registration occuring at boot time:

start_kernel()->proc_root_init()->proc_net_init(),
with
net_ns_init()->setup_net(&init_net, &init_user_ns)

also occuring in boot time from the same init_task.

When there are no another tasks to race with them,
for the single task it does not matter, which order
two sequential independent loads should be made.
So we make them reordered.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net_namespace.c