diff options
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r-- | net/sched/sch_api.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index e7fb9e0d21b4..506b709510b6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -624,7 +624,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; | 624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; |
625 | spinlock_t *root_lock; | 625 | spinlock_t *root_lock; |
626 | 626 | ||
627 | root_lock = qdisc_root_lock(oqdisc); | 627 | root_lock = qdisc_lock(oqdisc); |
628 | spin_lock_bh(root_lock); | 628 | spin_lock_bh(root_lock); |
629 | 629 | ||
630 | /* Prune old scheduler */ | 630 | /* Prune old scheduler */ |
@@ -635,7 +635,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
635 | if (qdisc == NULL) | 635 | if (qdisc == NULL) |
636 | qdisc = &noop_qdisc; | 636 | qdisc = &noop_qdisc; |
637 | dev_queue->qdisc_sleeping = qdisc; | 637 | dev_queue->qdisc_sleeping = qdisc; |
638 | dev_queue->qdisc = &noop_qdisc; | 638 | rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc); |
639 | 639 | ||
640 | spin_unlock_bh(root_lock); | 640 | spin_unlock_bh(root_lock); |
641 | 641 | ||
@@ -830,9 +830,16 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
830 | sch->stab = stab; | 830 | sch->stab = stab; |
831 | } | 831 | } |
832 | if (tca[TCA_RATE]) { | 832 | if (tca[TCA_RATE]) { |
833 | spinlock_t *root_lock; | ||
834 | |||
835 | if ((sch->parent != TC_H_ROOT) && | ||
836 | !(sch->flags & TCQ_F_INGRESS)) | ||
837 | root_lock = qdisc_root_sleeping_lock(sch); | ||
838 | else | ||
839 | root_lock = qdisc_lock(sch); | ||
840 | |||
833 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, | 841 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, |
834 | qdisc_root_lock(sch), | 842 | root_lock, tca[TCA_RATE]); |
835 | tca[TCA_RATE]); | ||
836 | if (err) { | 843 | if (err) { |
837 | /* | 844 | /* |
838 | * Any broken qdiscs that would require | 845 | * Any broken qdiscs that would require |
@@ -884,7 +891,8 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca) | |||
884 | 891 | ||
885 | if (tca[TCA_RATE]) | 892 | if (tca[TCA_RATE]) |
886 | gen_replace_estimator(&sch->bstats, &sch->rate_est, | 893 | gen_replace_estimator(&sch->bstats, &sch->rate_est, |
887 | qdisc_root_lock(sch), tca[TCA_RATE]); | 894 | qdisc_root_sleeping_lock(sch), |
895 | tca[TCA_RATE]); | ||
888 | return 0; | 896 | return 0; |
889 | } | 897 | } |
890 | 898 | ||