Merge branch 'dev-hold-per-netns-rtnl-in-register-netdev'
authorPaolo Abeni <pabeni@redhat.com>
Tue, 7 Jan 2025 12:45:58 +0000 (13:45 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 7 Jan 2025 12:45:58 +0000 (13:45 +0100)
commit04ced323ef70b89151f010f359be710357de2dac
tree635389a27d18e33a6d36188c7280eb353370658c
parent2f4f8893e07a58073b250ca1f07163efdca87ba9
parent00fb9823939ea39b553985b1b3f5377dc2386d63
Merge branch 'dev-hold-per-netns-rtnl-in-register-netdev'

Kuniyuki Iwashima says:

====================
dev: Hold per-netns RTNL in register_netdev().

Patch 1 adds rtnl_net_lock_killable() and Patch 2 uses it in
register_netdev() and converts it and unregister_netdev() to
per-netns RTNL.

With this and the netdev notifier series [0], ASSERT_RTNL_NET()
for NETDEV_REGISTER [1] wasn't fired on a simplest QEMU setup
like e1000 + x86_64_defconfig + CONFIG_DEBUG_NET_SMALL_RTNL.

[0]: https://lore.kernel.org/netdev/20250104063735.36945-1-kuniyu@amazon.com/

[1]:
---8<---
diff --git a/net/core/rtnl_net_debug.c b/net/core/rtnl_net_debug.c
index f406045cbd0e..c0c30929002e 100644
--- a/net/core/rtnl_net_debug.c
+++ b/net/core/rtnl_net_debug.c
@@ -21,7 +21,6 @@ static int rtnl_net_debug_event(struct notifier_block *nb,
  case NETDEV_DOWN:
  case NETDEV_REBOOT:
  case NETDEV_CHANGE:
- case NETDEV_REGISTER:
  case NETDEV_UNREGISTER:
  case NETDEV_CHANGEMTU:
  case NETDEV_CHANGEADDR:
@@ -60,19 +59,10 @@ static int rtnl_net_debug_event(struct notifier_block *nb,
  ASSERT_RTNL();
  break;

- /* Once an event fully supports RTNL_NET, move it here
-  * and remove "if (0)" below.
-  *
-  * case NETDEV_XXX:
-  * ASSERT_RTNL_NET(net);
-  * break;
-  */
- }
-
- /* Just to avoid unused-variable error for dev and net. */
- if (0)
+ case NETDEV_REGISTER:
  ASSERT_RTNL_NET(net);
+ break;
+ }

  return NOTIFY_DONE;
 }
---8<---
====================

Link: https://patch.msgid.link/20250104082149.48493-1-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>