summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2021-08-14 12:57:26 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-14 15:59:10 +0300
commitcbf6ab672eb425ac1cd7f8c7c4066f3bb0a78e50 (patch)
treeb692994a7ed3f5a1e6d9b2a83552b6aeb9787e0b /net/core
parent38e3bfa86964961291760e7da6227794106d2247 (diff)
downloadlinux-cbf6ab672eb425ac1cd7f8c7c4066f3bb0a78e50.tar.xz
devlink: Simplify devlink_pernet_pre_exit call
The devlink_pernet_pre_exit() will be called if net namespace exits. That routine is relevant for devlink instances that were assigned to that namespaces first. This assignment is possible only with the following command: "devlink reload DEV netns ...", which already checks reload support. Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index ee9787314cff..9e74a95b3322 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -11392,16 +11392,16 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net)
*/
mutex_lock(&devlink_mutex);
list_for_each_entry(devlink, &devlink_list, list) {
- if (net_eq(devlink_net(devlink), net)) {
- if (WARN_ON(!devlink_reload_supported(devlink->ops)))
- continue;
- err = devlink_reload(devlink, &init_net,
- DEVLINK_RELOAD_ACTION_DRIVER_REINIT,
- DEVLINK_RELOAD_LIMIT_UNSPEC,
- &actions_performed, NULL);
- if (err && err != -EOPNOTSUPP)
- pr_warn("Failed to reload devlink instance into init_net\n");
- }
+ if (!net_eq(devlink_net(devlink), net))
+ continue;
+
+ WARN_ON(!devlink_reload_supported(devlink->ops));
+ err = devlink_reload(devlink, &init_net,
+ DEVLINK_RELOAD_ACTION_DRIVER_REINIT,
+ DEVLINK_RELOAD_LIMIT_UNSPEC,
+ &actions_performed, NULL);
+ if (err && err != -EOPNOTSUPP)
+ pr_warn("Failed to reload devlink instance into init_net\n");
}
mutex_unlock(&devlink_mutex);
}