diff options
author | stephen hemminger <shemminger@vyatta.com> | 2009-11-10 02:54:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-11 01:26:31 -0500 |
commit | fa918602b61a71b4a9f47861b7e65c70258516c1 (patch) | |
tree | 052575c7add697afb550a025695a221c6680a046 /net | |
parent | e576b9ef41c2c1b13e0c123b6e9d0589723c68bf (diff) |
decnet: use RCU to find network devices
When showing device statistics use RCU rather than read_lock(&dev_base_lock)
Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/dn_dev.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index d82694d930b4..b5ef237c8a74 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -856,9 +856,7 @@ int dn_dev_bind_default(__le16 *addr) | |||
856 | dev = dn_dev_get_default(); | 856 | dev = dn_dev_get_default(); |
857 | last_chance: | 857 | last_chance: |
858 | if (dev) { | 858 | if (dev) { |
859 | read_lock(&dev_base_lock); | ||
860 | rv = dn_dev_get_first(dev, addr); | 859 | rv = dn_dev_get_first(dev, addr); |
861 | read_unlock(&dev_base_lock); | ||
862 | dev_put(dev); | 860 | dev_put(dev); |
863 | if (rv == 0 || dev == init_net.loopback_dev) | 861 | if (rv == 0 || dev == init_net.loopback_dev) |
864 | return rv; | 862 | return rv; |
@@ -1323,18 +1321,18 @@ static inline int is_dn_dev(struct net_device *dev) | |||
1323 | } | 1321 | } |
1324 | 1322 | ||
1325 | static void *dn_dev_seq_start(struct seq_file *seq, loff_t *pos) | 1323 | static void *dn_dev_seq_start(struct seq_file *seq, loff_t *pos) |
1326 | __acquires(&dev_base_lock) | 1324 | __acquires(rcu) |
1327 | { | 1325 | { |
1328 | int i; | 1326 | int i; |
1329 | struct net_device *dev; | 1327 | struct net_device *dev; |
1330 | 1328 | ||
1331 | read_lock(&dev_base_lock); | 1329 | rcu_read_lock(); |
1332 | 1330 | ||
1333 | if (*pos == 0) | 1331 | if (*pos == 0) |
1334 | return SEQ_START_TOKEN; | 1332 | return SEQ_START_TOKEN; |
1335 | 1333 | ||
1336 | i = 1; | 1334 | i = 1; |
1337 | for_each_netdev(&init_net, dev) { | 1335 | for_each_netdev_rcu(&init_net, dev) { |
1338 | if (!is_dn_dev(dev)) | 1336 | if (!is_dn_dev(dev)) |
1339 | continue; | 1337 | continue; |
1340 | 1338 | ||
@@ -1355,7 +1353,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1355 | if (v == SEQ_START_TOKEN) | 1353 | if (v == SEQ_START_TOKEN) |
1356 | dev = net_device_entry(&init_net.dev_base_head); | 1354 | dev = net_device_entry(&init_net.dev_base_head); |
1357 | 1355 | ||
1358 | for_each_netdev_continue(&init_net, dev) { | 1356 | for_each_netdev_continue_rcu(&init_net, dev) { |
1359 | if (!is_dn_dev(dev)) | 1357 | if (!is_dn_dev(dev)) |
1360 | continue; | 1358 | continue; |
1361 | 1359 | ||
@@ -1366,9 +1364,9 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1366 | } | 1364 | } |
1367 | 1365 | ||
1368 | static void dn_dev_seq_stop(struct seq_file *seq, void *v) | 1366 | static void dn_dev_seq_stop(struct seq_file *seq, void *v) |
1369 | __releases(&dev_base_lock) | 1367 | __releases(rcu) |
1370 | { | 1368 | { |
1371 | read_unlock(&dev_base_lock); | 1369 | rcu_read_unlock(); |
1372 | } | 1370 | } |
1373 | 1371 | ||
1374 | static char *dn_type2asc(char type) | 1372 | static char *dn_type2asc(char type) |