diff options
author | Patrick McHardy <kaber@trash.net> | 2007-04-16 20:00:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:05 -0400 |
commit | 6313c1e0992feaee56bc09b85042b3186041fa3c (patch) | |
tree | f75cda674d8f2b62bcdb09e59f8bc7010003a91f /net/core | |
parent | 1c2d670f3660e9103fdcdca702f6dbf8ea7d6afb (diff) |
[RTNETLINK]: Remove unnecessary locking in dump callbacks
Since we're now holding the rtnl during the entire dump operation, we can
remove additional locking for rtnl protected data. This patch does that
for all simple cases (dev_base_lock for dev_base walking, RCU protection
for FIB rule dumping).
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/fib_rules.c | 4 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 2 |
2 files changed, 1 insertions, 5 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index cb2dae19531b..8c5474e16683 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -495,8 +495,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, | |||
495 | int idx = 0; | 495 | int idx = 0; |
496 | struct fib_rule *rule; | 496 | struct fib_rule *rule; |
497 | 497 | ||
498 | rcu_read_lock(); | 498 | list_for_each_entry(rule, ops->rules_list, list) { |
499 | list_for_each_entry_rcu(rule, ops->rules_list, list) { | ||
500 | if (idx < cb->args[1]) | 499 | if (idx < cb->args[1]) |
501 | goto skip; | 500 | goto skip; |
502 | 501 | ||
@@ -507,7 +506,6 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, | |||
507 | skip: | 506 | skip: |
508 | idx++; | 507 | idx++; |
509 | } | 508 | } |
510 | rcu_read_unlock(); | ||
511 | cb->args[1] = idx; | 509 | cb->args[1] = idx; |
512 | rules_ops_put(ops); | 510 | rules_ops_put(ops); |
513 | 511 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 62f5c7f98d17..bc95fab0b0ce 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -543,7 +543,6 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
543 | int s_idx = cb->args[0]; | 543 | int s_idx = cb->args[0]; |
544 | struct net_device *dev; | 544 | struct net_device *dev; |
545 | 545 | ||
546 | read_lock(&dev_base_lock); | ||
547 | for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) { | 546 | for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) { |
548 | if (idx < s_idx) | 547 | if (idx < s_idx) |
549 | continue; | 548 | continue; |
@@ -552,7 +551,6 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
552 | cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0) | 551 | cb->nlh->nlmsg_seq, 0, NLM_F_MULTI) <= 0) |
553 | break; | 552 | break; |
554 | } | 553 | } |
555 | read_unlock(&dev_base_lock); | ||
556 | cb->args[0] = idx; | 554 | cb->args[0] = idx; |
557 | 555 | ||
558 | return skb->len; | 556 | return skb->len; |