Skip to content

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

Kuniyuki Iwashima netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2rtnetlink: Add rtnl_net_lock_killable().include/linux/rtnetlink.h net/core/rtnetlink.c+16 -11 replyApplied
2/2dev: Hold per-netns RTNL in (un)?register_netdev().net/core/dev.c+10 -41 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchEric Dumazet
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 net-next 0/2] 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/[email protected]/

[1]:
---8<---

net/core/rtnl_net_debug.c +3 -13
index f406045cbd0e..c0c30929002e 100644
@@ -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<---

Kuniyuki Iwashima (2):
rtnetlink: Add rtnl_net_lock_killable().
dev: Hold per-netns RTNL in (un)?register_netdev().

 include/linux/rtnetlink.h |  6 ++++++
 net/core/dev.c            | 14 ++++++++++----
 net/core/rtnetlink.c      | 11 ++++++++++-
 3 files changed, 26 insertions(+), 5 deletions(-)
Signature · 1 line
2.39.5 (Apple Git-154)