diff mbox series

[2/3] net: Register af_inet_ops earlier

Message ID 153743469969.21312.2316847616468846087.stgit@localhost.localdomain
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series Refactorings on af_inet pernet initialization | expand

Commit Message

Kirill Tkhai Sept. 20, 2018, 9:12 a.m. UTC
This function just initializes locks and defaults.
Let register it before other pernet operation,
since some of them potentially may relay on that.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 net/ipv4/af_inet.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Cong Wang Sept. 20, 2018, 5:03 p.m. UTC | #1
On Thu, Sep 20, 2018 at 2:12 AM Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>
> This function just initializes locks and defaults.
> Let register it before other pernet operation,
> since some of them potentially may relay on that.
>
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

It adds no benefits but potential risks on error path
ordering, it is never late to bring this up again when any
future change needs it, until that:

Nacked-by: Cong Wang <xiyou.wangcong@gmail.com>
diff mbox series

Patch

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f4ecbe0aaf1a..bbd3a072ffea 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1938,6 +1938,9 @@  static int __init inet_init(void)
 	for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
 		inet_register_protosw(q);
 
+	if (init_inet_pernet_ops())
+		pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
+
 	/*
 	 *	Set the ARP module up
 	 */
@@ -1975,9 +1978,6 @@  static int __init inet_init(void)
 	if (ip_mr_init())
 		pr_crit("%s: Cannot init ipv4 mroute\n", __func__);
 #endif
-
-	if (init_inet_pernet_ops())
-		pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
 	/*
 	 *	Initialise per-cpu ipv4 mibs
 	 */