summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Buslov <vladbu@mellanox.com>2018-09-24 12:22:50 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-25 23:17:35 -0400
commit86bd446b5cebd783187ea3772ff258210de77d99 (patch)
treea628c33098ece5577e51cdbe871fd5f97a5a064e
parent6f99528e9797794b91b43321fbbc93fe772b0803 (diff)
net: sched: rename qdisc_destroy() to qdisc_put()
Current implementation of qdisc_destroy() decrements Qdisc reference counter and only actually destroy Qdisc if reference counter value reached zero. Rename qdisc_destroy() to qdisc_put() in order for it to better describe the way in which this function currently implemented and used. Extract code that deallocates Qdisc into new private qdisc_destroy() function. It is intended to be shared between regular qdisc_put() and its unlocked version that is introduced in next patch in this series. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--net/sched/sch_api.c6
-rw-r--r--net/sched/sch_atm.c2
-rw-r--r--net/sched/sch_cbq.c2
-rw-r--r--net/sched/sch_cbs.c2
-rw-r--r--net/sched/sch_drr.c4
-rw-r--r--net/sched/sch_dsmark.c2
-rw-r--r--net/sched/sch_fifo.c2
-rw-r--r--net/sched/sch_generic.c23
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sched/sch_mq.c4
-rw-r--r--net/sched/sch_mqprio.c4
-rw-r--r--net/sched/sch_multiq.c6
-rw-r--r--net/sched/sch_netem.c2
-rw-r--r--net/sched/sch_prio.c6
-rw-r--r--net/sched/sch_qfq.c4
-rw-r--r--net/sched/sch_red.c4
-rw-r--r--net/sched/sch_sfb.c4
-rw-r--r--net/sched/sch_tbf.c4
20 files changed, 47 insertions, 42 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d326fd553b58..fadb1a4d4ee8 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -554,7 +554,7 @@ void dev_deactivate_many(struct list_head *head);
554struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, 554struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
555 struct Qdisc *qdisc); 555 struct Qdisc *qdisc);
556void qdisc_reset(struct Qdisc *qdisc); 556void qdisc_reset(struct Qdisc *qdisc);
557void qdisc_destroy(struct Qdisc *qdisc); 557void qdisc_put(struct Qdisc *qdisc);
558void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n, 558void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n,
559 unsigned int len); 559 unsigned int len);
560struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 560struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 411c40344b77..2096138c4bf6 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -920,7 +920,7 @@ static void notify_and_destroy(struct net *net, struct sk_buff *skb,
920 qdisc_notify(net, skb, n, clid, old, new); 920 qdisc_notify(net, skb, n, clid, old, new);
921 921
922 if (old) 922 if (old)
923 qdisc_destroy(old); 923 qdisc_put(old);
924} 924}
925 925
926/* Graft qdisc "new" to class "classid" of qdisc "parent" or 926/* Graft qdisc "new" to class "classid" of qdisc "parent" or
@@ -973,7 +973,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
973 qdisc_refcount_inc(new); 973 qdisc_refcount_inc(new);
974 974
975 if (!ingress) 975 if (!ingress)
976 qdisc_destroy(old); 976 qdisc_put(old);
977 } 977 }
978 978
979skip: 979skip:
@@ -1561,7 +1561,7 @@ graft:
1561 err = qdisc_graft(dev, p, skb, n, clid, q, NULL, extack); 1561 err = qdisc_graft(dev, p, skb, n, clid, q, NULL, extack);
1562 if (err) { 1562 if (err) {
1563 if (q) 1563 if (q)
1564 qdisc_destroy(q); 1564 qdisc_put(q);
1565 return err; 1565 return err;
1566 } 1566 }
1567 1567
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index cd49afca9617..d714d3747bcb 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -150,7 +150,7 @@ static void atm_tc_put(struct Qdisc *sch, unsigned long cl)
150 pr_debug("atm_tc_put: destroying\n"); 150 pr_debug("atm_tc_put: destroying\n");
151 list_del_init(&flow->list); 151 list_del_init(&flow->list);
152 pr_debug("atm_tc_put: qdisc %p\n", flow->q); 152 pr_debug("atm_tc_put: qdisc %p\n", flow->q);
153 qdisc_destroy(flow->q); 153 qdisc_put(flow->q);
154 tcf_block_put(flow->block); 154 tcf_block_put(flow->block);
155 if (flow->sock) { 155 if (flow->sock) {
156 pr_debug("atm_tc_put: f_count %ld\n", 156 pr_debug("atm_tc_put: f_count %ld\n",
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index f42025d53cfe..4dc05409e3fb 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1418,7 +1418,7 @@ static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl)
1418 WARN_ON(cl->filters); 1418 WARN_ON(cl->filters);
1419 1419
1420 tcf_block_put(cl->block); 1420 tcf_block_put(cl->block);
1421 qdisc_destroy(cl->q); 1421 qdisc_put(cl->q);
1422 qdisc_put_rtab(cl->R_tab); 1422 qdisc_put_rtab(cl->R_tab);
1423 gen_kill_estimator(&cl->rate_est); 1423 gen_kill_estimator(&cl->rate_est);
1424 if (cl != &q->link) 1424 if (cl != &q->link)
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index e26a24017faa..e689e11b6d0f 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -379,7 +379,7 @@ static void cbs_destroy(struct Qdisc *sch)
379 cbs_disable_offload(dev, q); 379 cbs_disable_offload(dev, q);
380 380
381 if (q->qdisc) 381 if (q->qdisc)
382 qdisc_destroy(q->qdisc); 382 qdisc_put(q->qdisc);
383} 383}
384 384
385static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb) 385static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb)
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index e0b0cf8a9939..cdebaed0f8cf 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -134,7 +134,7 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
134 tca[TCA_RATE]); 134 tca[TCA_RATE]);
135 if (err) { 135 if (err) {
136 NL_SET_ERR_MSG(extack, "Failed to replace estimator"); 136 NL_SET_ERR_MSG(extack, "Failed to replace estimator");
137 qdisc_destroy(cl->qdisc); 137 qdisc_put(cl->qdisc);
138 kfree(cl); 138 kfree(cl);
139 return err; 139 return err;
140 } 140 }
@@ -153,7 +153,7 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
153static void drr_destroy_class(struct Qdisc *sch, struct drr_class *cl) 153static void drr_destroy_class(struct Qdisc *sch, struct drr_class *cl)
154{ 154{
155 gen_kill_estimator(&cl->rate_est); 155 gen_kill_estimator(&cl->rate_est);
156 qdisc_destroy(cl->qdisc); 156 qdisc_put(cl->qdisc);
157 kfree(cl); 157 kfree(cl);
158} 158}
159 159
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 049714c57075..f6f480784bc6 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -412,7 +412,7 @@ static void dsmark_destroy(struct Qdisc *sch)
412 pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p); 412 pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p);
413 413
414 tcf_block_put(p->block); 414 tcf_block_put(p->block);
415 qdisc_destroy(p->q); 415 qdisc_put(p->q);
416 if (p->mv != p->embedded) 416 if (p->mv != p->embedded)
417 kfree(p->mv); 417 kfree(p->mv);
418} 418}
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index 24893d3b5d22..3809c9bf8896 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -177,7 +177,7 @@ struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
177 if (q) { 177 if (q) {
178 err = fifo_set_limit(q, limit); 178 err = fifo_set_limit(q, limit);
179 if (err < 0) { 179 if (err < 0) {
180 qdisc_destroy(q); 180 qdisc_put(q);
181 q = NULL; 181 q = NULL;
182 } 182 }
183 } 183 }
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index a64132a5db36..3e7696f3e053 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -901,7 +901,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
901 if (!ops->init || ops->init(sch, NULL, extack) == 0) 901 if (!ops->init || ops->init(sch, NULL, extack) == 0)
902 return sch; 902 return sch;
903 903
904 qdisc_destroy(sch); 904 qdisc_put(sch);
905 return NULL; 905 return NULL;
906} 906}
907EXPORT_SYMBOL(qdisc_create_dflt); 907EXPORT_SYMBOL(qdisc_create_dflt);
@@ -941,15 +941,11 @@ void qdisc_free(struct Qdisc *qdisc)
941 kfree((char *) qdisc - qdisc->padded); 941 kfree((char *) qdisc - qdisc->padded);
942} 942}
943 943
944void qdisc_destroy(struct Qdisc *qdisc) 944static void qdisc_destroy(struct Qdisc *qdisc)
945{ 945{
946 const struct Qdisc_ops *ops = qdisc->ops; 946 const struct Qdisc_ops *ops = qdisc->ops;
947 struct sk_buff *skb, *tmp; 947 struct sk_buff *skb, *tmp;
948 948
949 if (qdisc->flags & TCQ_F_BUILTIN ||
950 !refcount_dec_and_test(&qdisc->refcnt))
951 return;
952
953#ifdef CONFIG_NET_SCHED 949#ifdef CONFIG_NET_SCHED
954 qdisc_hash_del(qdisc); 950 qdisc_hash_del(qdisc);
955 951
@@ -976,7 +972,16 @@ void qdisc_destroy(struct Qdisc *qdisc)
976 972
977 qdisc_free(qdisc); 973 qdisc_free(qdisc);
978} 974}
979EXPORT_SYMBOL(qdisc_destroy); 975
976void qdisc_put(struct Qdisc *qdisc)
977{
978 if (qdisc->flags & TCQ_F_BUILTIN ||
979 !refcount_dec_and_test(&qdisc->refcnt))
980 return;
981
982 qdisc_destroy(qdisc);
983}
984EXPORT_SYMBOL(qdisc_put);
980 985
981/* Attach toplevel qdisc to device queue. */ 986/* Attach toplevel qdisc to device queue. */
982struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, 987struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
@@ -1270,7 +1275,7 @@ static void shutdown_scheduler_queue(struct net_device *dev,
1270 rcu_assign_pointer(dev_queue->qdisc, qdisc_default); 1275 rcu_assign_pointer(dev_queue->qdisc, qdisc_default);
1271 dev_queue->qdisc_sleeping = qdisc_default; 1276 dev_queue->qdisc_sleeping = qdisc_default;
1272 1277
1273 qdisc_destroy(qdisc); 1278 qdisc_put(qdisc);
1274 } 1279 }
1275} 1280}
1276 1281
@@ -1279,7 +1284,7 @@ void dev_shutdown(struct net_device *dev)
1279 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); 1284 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
1280 if (dev_ingress_queue(dev)) 1285 if (dev_ingress_queue(dev))
1281 shutdown_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc); 1286 shutdown_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc);
1282 qdisc_destroy(dev->qdisc); 1287 qdisc_put(dev->qdisc);
1283 dev->qdisc = &noop_qdisc; 1288 dev->qdisc = &noop_qdisc;
1284 1289
1285 WARN_ON(timer_pending(&dev->watchdog_timer)); 1290 WARN_ON(timer_pending(&dev->watchdog_timer));
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 3278a76f6861..b18ec1f6de60 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1092,7 +1092,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
1092 struct hfsc_sched *q = qdisc_priv(sch); 1092 struct hfsc_sched *q = qdisc_priv(sch);
1093 1093
1094 tcf_block_put(cl->block); 1094 tcf_block_put(cl->block);
1095 qdisc_destroy(cl->qdisc); 1095 qdisc_put(cl->qdisc);
1096 gen_kill_estimator(&cl->rate_est); 1096 gen_kill_estimator(&cl->rate_est);
1097 if (cl != &q->root) 1097 if (cl != &q->root)
1098 kfree(cl); 1098 kfree(cl);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 18ac2d6ca294..58b449490757 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1208,7 +1208,7 @@ static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
1208{ 1208{
1209 if (!cl->level) { 1209 if (!cl->level) {
1210 WARN_ON(!cl->leaf.q); 1210 WARN_ON(!cl->leaf.q);
1211 qdisc_destroy(cl->leaf.q); 1211 qdisc_put(cl->leaf.q);
1212 } 1212 }
1213 gen_kill_estimator(&cl->rate_est); 1213 gen_kill_estimator(&cl->rate_est);
1214 tcf_block_put(cl->block); 1214 tcf_block_put(cl->block);
@@ -1409,7 +1409,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1409 /* turn parent into inner node */ 1409 /* turn parent into inner node */
1410 qdisc_reset(parent->leaf.q); 1410 qdisc_reset(parent->leaf.q);
1411 qdisc_tree_reduce_backlog(parent->leaf.q, qlen, backlog); 1411 qdisc_tree_reduce_backlog(parent->leaf.q, qlen, backlog);
1412 qdisc_destroy(parent->leaf.q); 1412 qdisc_put(parent->leaf.q);
1413 if (parent->prio_activity) 1413 if (parent->prio_activity)
1414 htb_deactivate(q, parent); 1414 htb_deactivate(q, parent);
1415 1415
diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
index d6b8ae4ed7a3..f20f3a0f8424 100644
--- a/net/sched/sch_mq.c
+++ b/net/sched/sch_mq.c
@@ -65,7 +65,7 @@ static void mq_destroy(struct Qdisc *sch)
65 if (!priv->qdiscs) 65 if (!priv->qdiscs)
66 return; 66 return;
67 for (ntx = 0; ntx < dev->num_tx_queues && priv->qdiscs[ntx]; ntx++) 67 for (ntx = 0; ntx < dev->num_tx_queues && priv->qdiscs[ntx]; ntx++)
68 qdisc_destroy(priv->qdiscs[ntx]); 68 qdisc_put(priv->qdiscs[ntx]);
69 kfree(priv->qdiscs); 69 kfree(priv->qdiscs);
70} 70}
71 71
@@ -119,7 +119,7 @@ static void mq_attach(struct Qdisc *sch)
119 qdisc = priv->qdiscs[ntx]; 119 qdisc = priv->qdiscs[ntx];
120 old = dev_graft_qdisc(qdisc->dev_queue, qdisc); 120 old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
121 if (old) 121 if (old)
122 qdisc_destroy(old); 122 qdisc_put(old);
123#ifdef CONFIG_NET_SCHED 123#ifdef CONFIG_NET_SCHED
124 if (ntx < dev->real_num_tx_queues) 124 if (ntx < dev->real_num_tx_queues)
125 qdisc_hash_add(qdisc, false); 125 qdisc_hash_add(qdisc, false);
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 0e9d761cdd80..d364e63c396d 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -40,7 +40,7 @@ static void mqprio_destroy(struct Qdisc *sch)
40 for (ntx = 0; 40 for (ntx = 0;
41 ntx < dev->num_tx_queues && priv->qdiscs[ntx]; 41 ntx < dev->num_tx_queues && priv->qdiscs[ntx];
42 ntx++) 42 ntx++)
43 qdisc_destroy(priv->qdiscs[ntx]); 43 qdisc_put(priv->qdiscs[ntx]);
44 kfree(priv->qdiscs); 44 kfree(priv->qdiscs);
45 } 45 }
46 46
@@ -300,7 +300,7 @@ static void mqprio_attach(struct Qdisc *sch)
300 qdisc = priv->qdiscs[ntx]; 300 qdisc = priv->qdiscs[ntx];
301 old = dev_graft_qdisc(qdisc->dev_queue, qdisc); 301 old = dev_graft_qdisc(qdisc->dev_queue, qdisc);
302 if (old) 302 if (old)
303 qdisc_destroy(old); 303 qdisc_put(old);
304 if (ntx < dev->real_num_tx_queues) 304 if (ntx < dev->real_num_tx_queues)
305 qdisc_hash_add(qdisc, false); 305 qdisc_hash_add(qdisc, false);
306 } 306 }
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index 1da7ea8de0ad..7410ce4d0321 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -175,7 +175,7 @@ multiq_destroy(struct Qdisc *sch)
175 175
176 tcf_block_put(q->block); 176 tcf_block_put(q->block);
177 for (band = 0; band < q->bands; band++) 177 for (band = 0; band < q->bands; band++)
178 qdisc_destroy(q->queues[band]); 178 qdisc_put(q->queues[band]);
179 179
180 kfree(q->queues); 180 kfree(q->queues);
181} 181}
@@ -204,7 +204,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
204 q->queues[i] = &noop_qdisc; 204 q->queues[i] = &noop_qdisc;
205 qdisc_tree_reduce_backlog(child, child->q.qlen, 205 qdisc_tree_reduce_backlog(child, child->q.qlen,
206 child->qstats.backlog); 206 child->qstats.backlog);
207 qdisc_destroy(child); 207 qdisc_put(child);
208 } 208 }
209 } 209 }
210 210
@@ -228,7 +228,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
228 qdisc_tree_reduce_backlog(old, 228 qdisc_tree_reduce_backlog(old,
229 old->q.qlen, 229 old->q.qlen,
230 old->qstats.backlog); 230 old->qstats.backlog);
231 qdisc_destroy(old); 231 qdisc_put(old);
232 } 232 }
233 sch_tree_unlock(sch); 233 sch_tree_unlock(sch);
234 } 234 }
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 506e1960ed7f..57b3ad9394ad 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -1022,7 +1022,7 @@ static void netem_destroy(struct Qdisc *sch)
1022 1022
1023 qdisc_watchdog_cancel(&q->watchdog); 1023 qdisc_watchdog_cancel(&q->watchdog);
1024 if (q->qdisc) 1024 if (q->qdisc)
1025 qdisc_destroy(q->qdisc); 1025 qdisc_put(q->qdisc);
1026 dist_free(q->delay_dist); 1026 dist_free(q->delay_dist);
1027 dist_free(q->slot_dist); 1027 dist_free(q->slot_dist);
1028} 1028}
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 222e53d3d27a..f8af98621179 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -175,7 +175,7 @@ prio_destroy(struct Qdisc *sch)
175 tcf_block_put(q->block); 175 tcf_block_put(q->block);
176 prio_offload(sch, NULL); 176 prio_offload(sch, NULL);
177 for (prio = 0; prio < q->bands; prio++) 177 for (prio = 0; prio < q->bands; prio++)
178 qdisc_destroy(q->queues[prio]); 178 qdisc_put(q->queues[prio]);
179} 179}
180 180
181static int prio_tune(struct Qdisc *sch, struct nlattr *opt, 181static int prio_tune(struct Qdisc *sch, struct nlattr *opt,
@@ -205,7 +205,7 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt,
205 extack); 205 extack);
206 if (!queues[i]) { 206 if (!queues[i]) {
207 while (i > oldbands) 207 while (i > oldbands)
208 qdisc_destroy(queues[--i]); 208 qdisc_put(queues[--i]);
209 return -ENOMEM; 209 return -ENOMEM;
210 } 210 }
211 } 211 }
@@ -220,7 +220,7 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt,
220 220
221 qdisc_tree_reduce_backlog(child, child->q.qlen, 221 qdisc_tree_reduce_backlog(child, child->q.qlen,
222 child->qstats.backlog); 222 child->qstats.backlog);
223 qdisc_destroy(child); 223 qdisc_put(child);
224 } 224 }
225 225
226 for (i = oldbands; i < q->bands; i++) { 226 for (i = oldbands; i < q->bands; i++) {
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index bb1a9c11fc54..dc37c4ead439 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -526,7 +526,7 @@ set_change_agg:
526 return 0; 526 return 0;
527 527
528destroy_class: 528destroy_class:
529 qdisc_destroy(cl->qdisc); 529 qdisc_put(cl->qdisc);
530 kfree(cl); 530 kfree(cl);
531 return err; 531 return err;
532} 532}
@@ -537,7 +537,7 @@ static void qfq_destroy_class(struct Qdisc *sch, struct qfq_class *cl)
537 537
538 qfq_rm_from_agg(q, cl); 538 qfq_rm_from_agg(q, cl);
539 gen_kill_estimator(&cl->rate_est); 539 gen_kill_estimator(&cl->rate_est);
540 qdisc_destroy(cl->qdisc); 540 qdisc_put(cl->qdisc);
541 kfree(cl); 541 kfree(cl);
542} 542}
543 543
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 56c181c3feeb..3ce6c0a2c493 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -181,7 +181,7 @@ static void red_destroy(struct Qdisc *sch)
181 181
182 del_timer_sync(&q->adapt_timer); 182 del_timer_sync(&q->adapt_timer);
183 red_offload(sch, false); 183 red_offload(sch, false);
184 qdisc_destroy(q->qdisc); 184 qdisc_put(q->qdisc);
185} 185}
186 186
187static const struct nla_policy red_policy[TCA_RED_MAX + 1] = { 187static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
@@ -233,7 +233,7 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt,
233 if (child) { 233 if (child) {
234 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 234 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen,
235 q->qdisc->qstats.backlog); 235 q->qdisc->qstats.backlog);
236 qdisc_destroy(q->qdisc); 236 qdisc_put(q->qdisc);
237 q->qdisc = child; 237 q->qdisc = child;
238 } 238 }
239 239
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index 7cbdad8419b7..bab506b01a32 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -469,7 +469,7 @@ static void sfb_destroy(struct Qdisc *sch)
469 struct sfb_sched_data *q = qdisc_priv(sch); 469 struct sfb_sched_data *q = qdisc_priv(sch);
470 470
471 tcf_block_put(q->block); 471 tcf_block_put(q->block);
472 qdisc_destroy(q->qdisc); 472 qdisc_put(q->qdisc);
473} 473}
474 474
475static const struct nla_policy sfb_policy[TCA_SFB_MAX + 1] = { 475static const struct nla_policy sfb_policy[TCA_SFB_MAX + 1] = {
@@ -523,7 +523,7 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
523 523
524 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 524 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen,
525 q->qdisc->qstats.backlog); 525 q->qdisc->qstats.backlog);
526 qdisc_destroy(q->qdisc); 526 qdisc_put(q->qdisc);
527 q->qdisc = child; 527 q->qdisc = child;
528 528
529 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval); 529 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index a4530e85bd02..942dcca09cf2 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -392,7 +392,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt,
392 if (child) { 392 if (child) {
393 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, 393 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen,
394 q->qdisc->qstats.backlog); 394 q->qdisc->qstats.backlog);
395 qdisc_destroy(q->qdisc); 395 qdisc_put(q->qdisc);
396 q->qdisc = child; 396 q->qdisc = child;
397 } 397 }
398 q->limit = qopt->limit; 398 q->limit = qopt->limit;
@@ -438,7 +438,7 @@ static void tbf_destroy(struct Qdisc *sch)
438 struct tbf_sched_data *q = qdisc_priv(sch); 438 struct tbf_sched_data *q = qdisc_priv(sch);
439 439
440 qdisc_watchdog_cancel(&q->watchdog); 440 qdisc_watchdog_cancel(&q->watchdog);
441 qdisc_destroy(q->qdisc); 441 qdisc_put(q->qdisc);
442} 442}
443 443
444static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) 444static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)