Message ID | 20210928125500.167943-3-atenart@kernel.org (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Userspace spinning on net-sysfs access | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 8 maintainers not CCed: weiwan@google.com ap420073@gmail.com arnd@arndb.de bjorn@kernel.org memxor@gmail.com daniel@iogearbox.net edumazet@google.com alobakin@pm.me |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 6 this patch: 6 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 36 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 6 this patch: 6 |
netdev/header_inline | success | Link |
diff --git a/net/core/dev.c b/net/core/dev.c index fa989ab63f29..2f28b70e5244 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -385,13 +385,21 @@ static void unlist_netdevice(struct net_device *dev) /* Unlink dev from the device chain */ write_lock_bh(&dev_base_lock); list_del_rcu(&dev->dev_list); - netdev_name_node_del(dev->name_node); hlist_del_rcu(&dev->index_hlist); write_unlock_bh(&dev_base_lock); dev_base_seq_inc(dev_net(dev)); } +static void unlist_netdevice_name(struct net_device *dev) +{ + ASSERT_RTNL(); + + write_lock_bh(&dev_base_lock); + netdev_name_node_del(dev->name_node); + write_unlock_bh(&dev_base_lock); +} + /* * Our notifier list */ @@ -11030,6 +11038,7 @@ void unregister_netdevice_many(struct list_head *head) list_for_each_entry(dev, head, unreg_list) { /* And unlink it from device chain. */ unlist_netdevice(dev); + unlist_netdevice_name(dev); dev->reg_state = NETREG_UNREGISTERING; } @@ -11177,6 +11186,7 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net, /* And unlink it from device chain */ unlist_netdevice(dev); + unlist_netdevice_name(dev); synchronize_net();
This (mostly [*]) cosmetic patch spits the unlisting of the net device from the unlisting of its node name. The two unlisting are still done for now at the same places in the code, keeping the logic. [*] The two removals are now not done in a single dev_base_lock locking section. That is not an issue as insertion/deletion from both lists doesn't have to be atomic from the dev_base_lock point of view. Signed-off-by: Antoine Tenart <atenart@kernel.org> --- net/core/dev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)