ipv4: inetdev_by_index() switch to RCU
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 1 Nov 2009 19:23:04 +0000 (19:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Nov 2009 07:55:09 +0000 (23:55 -0800)
Use dev_get_by_index_rcu() instead of __dev_get_by_index() and
dev_base_lock rwlock

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/devinet.c

index 5df2f6a0b0f01da83bead89554bb7e7492298646..ccccaae50b2000e4cd13d16756496bc000a94686 100644 (file)
@@ -405,11 +405,12 @@ struct in_device *inetdev_by_index(struct net *net, int ifindex)
 {
        struct net_device *dev;
        struct in_device *in_dev = NULL;
-       read_lock(&dev_base_lock);
-       dev = __dev_get_by_index(net, ifindex);
+
+       rcu_read_lock();
+       dev = dev_get_by_index_rcu(net, ifindex);
        if (dev)
                in_dev = in_dev_get(dev);
-       read_unlock(&dev_base_lock);
+       rcu_read_unlock();
        return in_dev;
 }