summaryrefslogtreecommitdiffstats
path: root/net/devlink/core.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-01-06 07:33:55 +0100
committerDavid S. Miller <davem@davemloft.net>2023-01-06 13:56:18 +0100
commit7a54a5195b2a877a972ec21a5ca415c1fc2aec61 (patch)
treec90f07d1452bf03b1f6fd4b39c5894c05eb1fa7f /net/devlink/core.c
parentdevlink: bump the instance index directly when iterating (diff)
downloadlinux-7a54a5195b2a877a972ec21a5ca415c1fc2aec61.tar.xz
linux-7a54a5195b2a877a972ec21a5ca415c1fc2aec61.zip
devlink: update the code in netns move to latest helpers
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>
Diffstat (limited to 'net/devlink/core.c')
-rw-r--r--net/devlink/core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/devlink/core.c b/net/devlink/core.c
index 88c88b8053e2..d3b8336946fd 100644
--- a/net/devlink/core.c
+++ b/net/devlink/core.c
@@ -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);
}
}