Commit cbf6ab67 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

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: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38e3bfa8
...@@ -11392,16 +11392,16 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net) ...@@ -11392,16 +11392,16 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net)
*/ */
mutex_lock(&devlink_mutex); mutex_lock(&devlink_mutex);
list_for_each_entry(devlink, &devlink_list, list) { list_for_each_entry(devlink, &devlink_list, list) {
if (net_eq(devlink_net(devlink), net)) { if (!net_eq(devlink_net(devlink), net))
if (WARN_ON(!devlink_reload_supported(devlink->ops))) continue;
continue;
err = devlink_reload(devlink, &init_net, WARN_ON(!devlink_reload_supported(devlink->ops));
DEVLINK_RELOAD_ACTION_DRIVER_REINIT, err = devlink_reload(devlink, &init_net,
DEVLINK_RELOAD_LIMIT_UNSPEC, DEVLINK_RELOAD_ACTION_DRIVER_REINIT,
&actions_performed, NULL); DEVLINK_RELOAD_LIMIT_UNSPEC,
if (err && err != -EOPNOTSUPP) &actions_performed, NULL);
pr_warn("Failed to reload devlink instance into init_net\n"); if (err && err != -EOPNOTSUPP)
} pr_warn("Failed to reload devlink instance into init_net\n");
} }
mutex_unlock(&devlink_mutex); mutex_unlock(&devlink_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment