Skip to content

Commit

Permalink
devlink: update the code in netns move to latest helpers
Browse files Browse the repository at this point in the history
devlink_pernet_pre_exit() is the only obvious place which takes
the instance lock without using the devl_ helpers. Update the code
and move the error print after releasing the reference
(having unlock and put together feels slightly idiomatic).

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Jan 6, 2023
1 parent d772781 commit 7a54a51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/devlink/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,16 @@ static void __net_exit devlink_pernet_pre_exit(struct net *net)
*/
devlinks_xa_for_each_registered_get(net, index, devlink) {
WARN_ON(!(devlink->features & DEVLINK_F_RELOAD));
mutex_lock(&devlink->lock);
devl_lock(devlink);
err = devlink_reload(devlink, &init_net,
DEVLINK_RELOAD_ACTION_DRIVER_REINIT,
DEVLINK_RELOAD_LIMIT_UNSPEC,
&actions_performed, NULL);
mutex_unlock(&devlink->lock);
devl_unlock(devlink);
devlink_put(devlink);

if (err && err != -EOPNOTSUPP)
pr_warn("Failed to reload devlink instance into init_net\n");
devlink_put(devlink);
}
}

Expand Down

0 comments on commit 7a54a51

Please sign in to comment.