Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "pkt_sched: Protect gen estimators under est_lock."

This reverts commit d4766692e72422f3b0f0e9ac6773d92baad07d51.

qdisc_destroy() now runs in RTNL fully again, so this
change is no longer needed.

Signed-off-by: David S. Miller <davem@davemloft.net>

+4 -5
+4 -5
net/core/gen_estimator.c
··· 99 99 100 100 static struct gen_estimator_head elist[EST_MAX_INTERVAL+1]; 101 101 102 - /* Protects against NULL dereference and RCU write-side */ 102 + /* Protects against NULL dereference */ 103 103 static DEFINE_RWLOCK(est_lock); 104 104 105 105 static void est_timer(unsigned long arg) ··· 185 185 est->last_packets = bstats->packets; 186 186 est->avpps = rate_est->pps<<10; 187 187 188 - write_lock_bh(&est_lock); 189 188 if (!elist[idx].timer.function) { 190 189 INIT_LIST_HEAD(&elist[idx].list); 191 190 setup_timer(&elist[idx].timer, est_timer, idx); ··· 194 195 mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx)); 195 196 196 197 list_add_rcu(&est->list, &elist[idx].list); 197 - write_unlock_bh(&est_lock); 198 198 return 0; 199 199 } 200 200 ··· 212 214 * Removes the rate estimator specified by &bstats and &rate_est 213 215 * and deletes the timer. 214 216 * 217 + * NOTE: Called under rtnl_mutex 215 218 */ 216 219 void gen_kill_estimator(struct gnet_stats_basic *bstats, 217 220 struct gnet_stats_rate_est *rate_est) ··· 226 227 if (!elist[idx].timer.function) 227 228 continue; 228 229 229 - write_lock_bh(&est_lock); 230 230 list_for_each_entry_safe(e, n, &elist[idx].list, list) { 231 231 if (e->rate_est != rate_est || e->bstats != bstats) 232 232 continue; 233 233 234 + write_lock_bh(&est_lock); 234 235 e->bstats = NULL; 236 + write_unlock_bh(&est_lock); 235 237 236 238 list_del_rcu(&e->list); 237 239 call_rcu(&e->e_rcu, __gen_kill_estimator); 238 240 } 239 - write_unlock_bh(&est_lock); 240 241 } 241 242 } 242 243