[RTNETLINK]: Remove unnecessary locking in dump callbacks
[deliverable/linux.git] / net / core / fib_rules.c
index 5824b2644f26b6d8c3dc4743626b7c1c8050d9dd..8c5474e16683aa22971b1bed0390354b728a0f64 100644 (file)
@@ -44,6 +44,12 @@ static void rules_ops_put(struct fib_rules_ops *ops)
                module_put(ops->owner);
 }
 
+static void flush_route_cache(struct fib_rules_ops *ops)
+{
+       if (ops->flush_cache)
+               ops->flush_cache();
+}
+
 int fib_rules_register(struct fib_rules_ops *ops)
 {
        int err = -EEXIST;
@@ -314,6 +320,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                list_add_rcu(&rule->list, ops->rules_list);
 
        notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).pid);
+       flush_route_cache(ops);
        rules_ops_put(ops);
        return 0;
 
@@ -404,6 +411,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
                notify_rule_change(RTM_DELRULE, rule, ops, nlh,
                                   NETLINK_CB(skb).pid);
                fib_rule_put(rule);
+               flush_route_cache(ops);
                rules_ops_put(ops);
                return 0;
        }
@@ -487,8 +495,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
        int idx = 0;
        struct fib_rule *rule;
 
-       rcu_read_lock();
-       list_for_each_entry_rcu(rule, ops->rules_list, list) {
+       list_for_each_entry(rule, ops->rules_list, list) {
                if (idx < cb->args[1])
                        goto skip;
 
@@ -499,7 +506,6 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
 skip:
                idx++;
        }
-       rcu_read_unlock();
        cb->args[1] = idx;
        rules_ops_put(ops);
 
This page took 0.0366 seconds and 5 git commands to generate.