diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-08-29 17:21:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 17:27:52 -0400 |
commit | 102396ae65108b026e4e1868e30fa013f45a169e (patch) | |
tree | 1164f9020a3fa47460a2ab72e07c3308be2290ee /net/sched | |
parent | 3cc76caa98b092a8fb3e7b4303c70f847db0651f (diff) |
pkt_sched: Fix locking of qdisc_root with qdisc_root_sleeping_lock()
Use qdisc_root_sleeping_lock() instead of qdisc_root_lock() where
appropriate. The only difference is while dev is deactivated, when
currently we can use a sleeping qdisc with the lock of noop_qdisc.
This shouldn't be dangerous since after deactivation root lock could
be used only by gen_estimator code, but looks wrong anyway.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/cls_api.c | 2 | ||||
-rw-r--r-- | net/sched/cls_route.c | 2 | ||||
-rw-r--r-- | net/sched/sch_api.c | 8 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 2 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 4 | ||||
-rw-r--r-- | net/sched/sch_netem.c | 2 | ||||
-rw-r--r-- | net/sched/sch_teql.c | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5cafdd4c8018..8eb79e92e94c 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -205,7 +205,7 @@ replay: | |||
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | root_lock = qdisc_root_lock(q); | 208 | root_lock = qdisc_root_sleeping_lock(q); |
209 | 209 | ||
210 | if (tp == NULL) { | 210 | if (tp == NULL) { |
211 | /* Proto-tcf does not exist, create new one */ | 211 | /* Proto-tcf does not exist, create new one */ |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 481260a4f10f..e3d8455eebc2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -75,7 +75,7 @@ static __inline__ int route4_fastmap_hash(u32 id, int iif) | |||
75 | static inline | 75 | static inline |
76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) | 76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) |
77 | { | 77 | { |
78 | spinlock_t *root_lock = qdisc_root_lock(q); | 78 | spinlock_t *root_lock = qdisc_root_sleeping_lock(q); |
79 | 79 | ||
80 | spin_lock_bh(root_lock); | 80 | spin_lock_bh(root_lock); |
81 | memset(head->fastmap, 0, sizeof(head->fastmap)); | 81 | memset(head->fastmap, 0, sizeof(head->fastmap)); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 506b709510b6..1122c952aa99 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1169,8 +1169,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) | 1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) |
1170 | goto nla_put_failure; | 1170 | goto nla_put_failure; |
1171 | 1171 | ||
1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1173 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1173 | qdisc_root_sleeping_lock(q), &d) < 0) |
1174 | goto nla_put_failure; | 1174 | goto nla_put_failure; |
1175 | 1175 | ||
1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) | 1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) |
@@ -1461,8 +1461,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) | 1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) |
1462 | goto nla_put_failure; | 1462 | goto nla_put_failure; |
1463 | 1463 | ||
1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
1465 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1465 | qdisc_root_sleeping_lock(q), &d) < 0) |
1466 | goto nla_put_failure; | 1466 | goto nla_put_failure; |
1467 | 1467 | ||
1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) | 1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 9b720adedead..8b06fa900482 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1754,7 +1754,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg) | |||
1754 | 1754 | ||
1755 | if (--cl->refcnt == 0) { | 1755 | if (--cl->refcnt == 0) { |
1756 | #ifdef CONFIG_NET_CLS_ACT | 1756 | #ifdef CONFIG_NET_CLS_ACT |
1757 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1757 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1758 | struct cbq_sched_data *q = qdisc_priv(sch); | 1758 | struct cbq_sched_data *q = qdisc_priv(sch); |
1759 | 1759 | ||
1760 | spin_lock_bh(root_lock); | 1760 | spin_lock_bh(root_lock); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 97d4761cc31e..d14f02056ae6 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1043,7 +1043,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | |||
1043 | 1043 | ||
1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | 1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) |
1045 | { | 1045 | { |
1046 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1046 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1047 | struct htb_sched *q = qdisc_priv(sch); | 1047 | struct htb_sched *q = qdisc_priv(sch); |
1048 | struct nlattr *nest; | 1048 | struct nlattr *nest; |
1049 | struct tc_htb_glob gopt; | 1049 | struct tc_htb_glob gopt; |
@@ -1075,7 +1075,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
1075 | struct sk_buff *skb, struct tcmsg *tcm) | 1075 | struct sk_buff *skb, struct tcmsg *tcm) |
1076 | { | 1076 | { |
1077 | struct htb_class *cl = (struct htb_class *)arg; | 1077 | struct htb_class *cl = (struct htb_class *)arg; |
1078 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1078 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
1079 | struct nlattr *nest; | 1079 | struct nlattr *nest; |
1080 | struct tc_htb_opt opt; | 1080 | struct tc_htb_opt opt; |
1081 | 1081 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index fb0294d0b55e..3781e55046d0 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -341,7 +341,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
341 | for (i = 0; i < n; i++) | 341 | for (i = 0; i < n; i++) |
342 | d->table[i] = data[i]; | 342 | d->table[i] = data[i]; |
343 | 343 | ||
344 | root_lock = qdisc_root_lock(sch); | 344 | root_lock = qdisc_root_sleeping_lock(sch); |
345 | 345 | ||
346 | spin_lock_bh(root_lock); | 346 | spin_lock_bh(root_lock); |
347 | d = xchg(&q->delay_dist, d); | 347 | d = xchg(&q->delay_dist, d); |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 2c35c678563b..d35ef059abb1 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -161,7 +161,7 @@ teql_destroy(struct Qdisc* sch) | |||
161 | txq = netdev_get_tx_queue(master->dev, 0); | 161 | txq = netdev_get_tx_queue(master->dev, 0); |
162 | master->slaves = NULL; | 162 | master->slaves = NULL; |
163 | 163 | ||
164 | root_lock = qdisc_root_lock(txq->qdisc); | 164 | root_lock = qdisc_root_sleeping_lock(txq->qdisc); |
165 | spin_lock_bh(root_lock); | 165 | spin_lock_bh(root_lock); |
166 | qdisc_reset(txq->qdisc); | 166 | qdisc_reset(txq->qdisc); |
167 | spin_unlock_bh(root_lock); | 167 | spin_unlock_bh(root_lock); |