Commit fa918602 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e576b9ef
...@@ -856,9 +856,7 @@ int dn_dev_bind_default(__le16 *addr) ...@@ -856,9 +856,7 @@ int dn_dev_bind_default(__le16 *addr)
dev = dn_dev_get_default(); dev = dn_dev_get_default();
last_chance: last_chance:
if (dev) { if (dev) {
read_lock(&dev_base_lock);
rv = dn_dev_get_first(dev, addr); rv = dn_dev_get_first(dev, addr);
read_unlock(&dev_base_lock);
dev_put(dev); dev_put(dev);
if (rv == 0 || dev == init_net.loopback_dev) if (rv == 0 || dev == init_net.loopback_dev)
return rv; return rv;
...@@ -1323,18 +1321,18 @@ static inline int is_dn_dev(struct net_device *dev) ...@@ -1323,18 +1321,18 @@ static inline int is_dn_dev(struct net_device *dev)
} }
static void *dn_dev_seq_start(struct seq_file *seq, loff_t *pos) static void *dn_dev_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(&dev_base_lock) __acquires(rcu)
{ {
int i; int i;
struct net_device *dev; struct net_device *dev;
read_lock(&dev_base_lock); rcu_read_lock();
if (*pos == 0) if (*pos == 0)
return SEQ_START_TOKEN; return SEQ_START_TOKEN;
i = 1; i = 1;
for_each_netdev(&init_net, dev) { for_each_netdev_rcu(&init_net, dev) {
if (!is_dn_dev(dev)) if (!is_dn_dev(dev))
continue; continue;
...@@ -1355,7 +1353,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1355,7 +1353,7 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
dev = net_device_entry(&init_net.dev_base_head); dev = net_device_entry(&init_net.dev_base_head);
for_each_netdev_continue(&init_net, dev) { for_each_netdev_continue_rcu(&init_net, dev) {
if (!is_dn_dev(dev)) if (!is_dn_dev(dev))
continue; continue;
...@@ -1366,9 +1364,9 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1366,9 +1364,9 @@ static void *dn_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
} }
static void dn_dev_seq_stop(struct seq_file *seq, void *v) static void dn_dev_seq_stop(struct seq_file *seq, void *v)
__releases(&dev_base_lock) __releases(rcu)
{ {
read_unlock(&dev_base_lock); rcu_read_unlock();
} }
static char *dn_type2asc(char type) static char *dn_type2asc(char type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment