Commit deb3abf1 authored by David S. Miller's avatar David S. Miller

Revert "pkt_sched: Protect gen estimators under est_lock."

This reverts commit d4766692.

qdisc_destroy() now runs in RTNL fully again, so this
change is no longer needed.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e5befbd9
...@@ -99,7 +99,7 @@ struct gen_estimator_head ...@@ -99,7 +99,7 @@ struct gen_estimator_head
static struct gen_estimator_head elist[EST_MAX_INTERVAL+1]; static struct gen_estimator_head elist[EST_MAX_INTERVAL+1];
/* Protects against NULL dereference and RCU write-side */ /* Protects against NULL dereference */
static DEFINE_RWLOCK(est_lock); static DEFINE_RWLOCK(est_lock);
static void est_timer(unsigned long arg) static void est_timer(unsigned long arg)
...@@ -185,7 +185,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats, ...@@ -185,7 +185,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
est->last_packets = bstats->packets; est->last_packets = bstats->packets;
est->avpps = rate_est->pps<<10; est->avpps = rate_est->pps<<10;
write_lock_bh(&est_lock);
if (!elist[idx].timer.function) { if (!elist[idx].timer.function) {
INIT_LIST_HEAD(&elist[idx].list); INIT_LIST_HEAD(&elist[idx].list);
setup_timer(&elist[idx].timer, est_timer, idx); setup_timer(&elist[idx].timer, est_timer, idx);
...@@ -195,7 +194,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats, ...@@ -195,7 +194,6 @@ int gen_new_estimator(struct gnet_stats_basic *bstats,
mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx)); mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx));
list_add_rcu(&est->list, &elist[idx].list); list_add_rcu(&est->list, &elist[idx].list);
write_unlock_bh(&est_lock);
return 0; return 0;
} }
...@@ -214,6 +212,7 @@ static void __gen_kill_estimator(struct rcu_head *head) ...@@ -214,6 +212,7 @@ static void __gen_kill_estimator(struct rcu_head *head)
* Removes the rate estimator specified by &bstats and &rate_est * Removes the rate estimator specified by &bstats and &rate_est
* and deletes the timer. * and deletes the timer.
* *
* NOTE: Called under rtnl_mutex
*/ */
void gen_kill_estimator(struct gnet_stats_basic *bstats, void gen_kill_estimator(struct gnet_stats_basic *bstats,
struct gnet_stats_rate_est *rate_est) struct gnet_stats_rate_est *rate_est)
...@@ -227,17 +226,17 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats, ...@@ -227,17 +226,17 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
if (!elist[idx].timer.function) if (!elist[idx].timer.function)
continue; continue;
write_lock_bh(&est_lock);
list_for_each_entry_safe(e, n, &elist[idx].list, list) { list_for_each_entry_safe(e, n, &elist[idx].list, list) {
if (e->rate_est != rate_est || e->bstats != bstats) if (e->rate_est != rate_est || e->bstats != bstats)
continue; continue;
write_lock_bh(&est_lock);
e->bstats = NULL; e->bstats = NULL;
write_unlock_bh(&est_lock);
list_del_rcu(&e->list); list_del_rcu(&e->list);
call_rcu(&e->e_rcu, __gen_kill_estimator); call_rcu(&e->e_rcu, __gen_kill_estimator);
} }
write_unlock_bh(&est_lock);
} }
} }
......
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