diff options
-rw-r--r-- | drivers/net/bonding/bond_procfs.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 1a9fe1ba4c60..bb09d0442aa8 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -7,21 +7,18 @@ | |||
7 | 7 | ||
8 | static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | 8 | static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) |
9 | __acquires(RCU) | 9 | __acquires(RCU) |
10 | __acquires(&bond->lock) | ||
11 | { | 10 | { |
12 | struct bonding *bond = seq->private; | 11 | struct bonding *bond = seq->private; |
13 | struct list_head *iter; | 12 | struct list_head *iter; |
14 | struct slave *slave; | 13 | struct slave *slave; |
15 | loff_t off = 0; | 14 | loff_t off = 0; |
16 | 15 | ||
17 | /* make sure the bond won't be taken away */ | ||
18 | rcu_read_lock(); | 16 | rcu_read_lock(); |
19 | read_lock(&bond->lock); | ||
20 | 17 | ||
21 | if (*pos == 0) | 18 | if (*pos == 0) |
22 | return SEQ_START_TOKEN; | 19 | return SEQ_START_TOKEN; |
23 | 20 | ||
24 | bond_for_each_slave(bond, slave, iter) | 21 | bond_for_each_slave_rcu(bond, slave, iter) |
25 | if (++off == *pos) | 22 | if (++off == *pos) |
26 | return slave; | 23 | return slave; |
27 | 24 | ||
@@ -37,12 +34,9 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
37 | 34 | ||
38 | ++*pos; | 35 | ++*pos; |
39 | if (v == SEQ_START_TOKEN) | 36 | if (v == SEQ_START_TOKEN) |
40 | return bond_first_slave(bond); | 37 | return bond_first_slave_rcu(bond); |
41 | 38 | ||
42 | if (bond_is_last_slave(bond, v)) | 39 | bond_for_each_slave_rcu(bond, slave, iter) { |
43 | return NULL; | ||
44 | |||
45 | bond_for_each_slave(bond, slave, iter) { | ||
46 | if (found) | 40 | if (found) |
47 | return slave; | 41 | return slave; |
48 | if (slave == v) | 42 | if (slave == v) |
@@ -53,12 +47,8 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
53 | } | 47 | } |
54 | 48 | ||
55 | static void bond_info_seq_stop(struct seq_file *seq, void *v) | 49 | static void bond_info_seq_stop(struct seq_file *seq, void *v) |
56 | __releases(&bond->lock) | ||
57 | __releases(RCU) | 50 | __releases(RCU) |
58 | { | 51 | { |
59 | struct bonding *bond = seq->private; | ||
60 | |||
61 | read_unlock(&bond->lock); | ||
62 | rcu_read_unlock(); | 52 | rcu_read_unlock(); |
63 | } | 53 | } |
64 | 54 | ||