diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-08-27 05:25:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-27 05:25:17 -0400 |
commit | f6f9b93f1624206c802ac9162c9302edaf59bfd9 (patch) | |
tree | 643bd211bf909118311138e588a78834fad7a40d /net/sched/sch_htb.c | |
parent | f7a54c13c7b072d9426bd5cec1cdb8306df5ef55 (diff) |
pkt_sched: Fix gen_estimator locks
While passing a qdisc root lock to gen_new_estimator() and
gen_replace_estimator() dev could be deactivated or even before
grafting proper root qdisc as qdisc_sleeping (e.g. qdisc_create), so
using qdisc_root_lock() is not enough. This patch adds
qdisc_root_sleeping_lock() for this, plus additional checks, where
necessary.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0df0df202ed0..97d4761cc31e 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1372,7 +1372,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1372 | goto failure; | 1372 | goto failure; |
1373 | 1373 | ||
1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1375 | qdisc_root_lock(sch), | 1375 | qdisc_root_sleeping_lock(sch), |
1376 | tca[TCA_RATE] ? : &est.nla); | 1376 | tca[TCA_RATE] ? : &est.nla); |
1377 | cl->refcnt = 1; | 1377 | cl->refcnt = 1; |
1378 | cl->children = 0; | 1378 | cl->children = 0; |
@@ -1427,7 +1427,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1427 | } else { | 1427 | } else { |
1428 | if (tca[TCA_RATE]) | 1428 | if (tca[TCA_RATE]) |
1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1430 | qdisc_root_lock(sch), | 1430 | qdisc_root_sleeping_lock(sch), |
1431 | tca[TCA_RATE]); | 1431 | tca[TCA_RATE]); |
1432 | sch_tree_lock(sch); | 1432 | sch_tree_lock(sch); |
1433 | } | 1433 | } |