]> Git Repo - linux.git/commitdiff
net: devlink: remove redundant rtnl lock assert
authorVlad Buslov <[email protected]>
Mon, 12 Aug 2019 17:02:02 +0000 (20:02 +0300)
committerJakub Kicinski <[email protected]>
Tue, 13 Aug 2019 23:47:11 +0000 (16:47 -0700)
It is enough for caller of devlink_compat_switch_id_get() to hold the net
device to guarantee that devlink port is not destroyed concurrently. Remove
rtnl lock assertion and modify comment to warn user that they must hold
either rtnl lock or reference to net device. This is necessary to
accommodate future implementation of rtnl-unlocked TC offloads driver
callbacks.

Signed-off-by: Vlad Buslov <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
net/core/devlink.c

index e3a1ae44f93d1f972933ca7c6e832b13230ca80b..d3dbb904bf3b1ce9aaa1a4873f6407aa621e8b3d 100644 (file)
@@ -6939,11 +6939,10 @@ int devlink_compat_switch_id_get(struct net_device *dev,
 {
        struct devlink_port *devlink_port;
 
-       /* RTNL mutex is held here which ensures that devlink_port
-        * instance cannot disappear in the middle. No need to take
+       /* Caller must hold RTNL mutex or reference to dev, which ensures that
+        * devlink_port instance cannot disappear in the middle. No need to take
         * any devlink lock as only permanent values are accessed.
         */
-       ASSERT_RTNL();
        devlink_port = netdev_to_devlink_port(dev);
        if (!devlink_port || !devlink_port->attrs.switch_port)
                return -EOPNOTSUPP;
This page took 0.078645 seconds and 4 git commands to generate.