diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-01-24 15:54:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-24 16:01:09 -0500 |
commit | 715df5ecab0f22685930cb8bb0cc70ed8fb9279e (patch) | |
tree | fb334ed46c620e7e88595867c7facc3def3e01c7 | |
parent | 46410c2efa9cb5b2f40c9ce24a75d147f44aedeb (diff) |
net: sched: propagate extack to cls->destroy callbacks
Propagate extack to cls->destroy callbacks when called from
non-error paths. On error paths pass NULL to avoid overwriting
the failure message.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sch_generic.h | 3 | ||||
-rw-r--r-- | net/sched/cls_api.c | 15 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 2 | ||||
-rw-r--r-- | net/sched/cls_bpf.c | 3 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 3 | ||||
-rw-r--r-- | net/sched/cls_flow.c | 2 | ||||
-rw-r--r-- | net/sched/cls_flower.c | 2 | ||||
-rw-r--r-- | net/sched/cls_fw.c | 2 | ||||
-rw-r--r-- | net/sched/cls_matchall.c | 2 | ||||
-rw-r--r-- | net/sched/cls_route.c | 2 | ||||
-rw-r--r-- | net/sched/cls_rsvp.h | 2 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 3 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 2 |
13 files changed, 24 insertions, 19 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index cd1be1f25c36..eac43e8ca96d 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -233,7 +233,8 @@ struct tcf_proto_ops { | |||
233 | const struct tcf_proto *, | 233 | const struct tcf_proto *, |
234 | struct tcf_result *); | 234 | struct tcf_result *); |
235 | int (*init)(struct tcf_proto*); | 235 | int (*init)(struct tcf_proto*); |
236 | void (*destroy)(struct tcf_proto*); | 236 | void (*destroy)(struct tcf_proto *tp, |
237 | struct netlink_ext_ack *extack); | ||
237 | 238 | ||
238 | void* (*get)(struct tcf_proto*, u32 handle); | 239 | void* (*get)(struct tcf_proto*, u32 handle); |
239 | int (*change)(struct net *net, struct sk_buff *, | 240 | int (*change)(struct net *net, struct sk_buff *, |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index f5d293416f46..bcb4ccb5f894 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -172,9 +172,10 @@ errout: | |||
172 | return ERR_PTR(err); | 172 | return ERR_PTR(err); |
173 | } | 173 | } |
174 | 174 | ||
175 | static void tcf_proto_destroy(struct tcf_proto *tp) | 175 | static void tcf_proto_destroy(struct tcf_proto *tp, |
176 | struct netlink_ext_ack *extack) | ||
176 | { | 177 | { |
177 | tp->ops->destroy(tp); | 178 | tp->ops->destroy(tp, extack); |
178 | module_put(tp->ops->owner); | 179 | module_put(tp->ops->owner); |
179 | kfree_rcu(tp, rcu); | 180 | kfree_rcu(tp, rcu); |
180 | } | 181 | } |
@@ -223,7 +224,7 @@ static void tcf_chain_flush(struct tcf_chain *chain) | |||
223 | tcf_chain_head_change(chain, NULL); | 224 | tcf_chain_head_change(chain, NULL); |
224 | while (tp) { | 225 | while (tp) { |
225 | RCU_INIT_POINTER(chain->filter_chain, tp->next); | 226 | RCU_INIT_POINTER(chain->filter_chain, tp->next); |
226 | tcf_proto_destroy(tp); | 227 | tcf_proto_destroy(tp, NULL); |
227 | tp = rtnl_dereference(chain->filter_chain); | 228 | tp = rtnl_dereference(chain->filter_chain); |
228 | tcf_chain_put(chain); | 229 | tcf_chain_put(chain); |
229 | } | 230 | } |
@@ -1182,7 +1183,7 @@ replay: | |||
1182 | tcf_chain_tp_remove(chain, &chain_info, tp); | 1183 | tcf_chain_tp_remove(chain, &chain_info, tp); |
1183 | tfilter_notify(net, skb, n, tp, block, q, parent, fh, | 1184 | tfilter_notify(net, skb, n, tp, block, q, parent, fh, |
1184 | RTM_DELTFILTER, false); | 1185 | RTM_DELTFILTER, false); |
1185 | tcf_proto_destroy(tp); | 1186 | tcf_proto_destroy(tp, extack); |
1186 | err = 0; | 1187 | err = 0; |
1187 | goto errout; | 1188 | goto errout; |
1188 | } | 1189 | } |
@@ -1200,7 +1201,7 @@ replay: | |||
1200 | case RTM_NEWTFILTER: | 1201 | case RTM_NEWTFILTER: |
1201 | if (n->nlmsg_flags & NLM_F_EXCL) { | 1202 | if (n->nlmsg_flags & NLM_F_EXCL) { |
1202 | if (tp_created) | 1203 | if (tp_created) |
1203 | tcf_proto_destroy(tp); | 1204 | tcf_proto_destroy(tp, NULL); |
1204 | NL_SET_ERR_MSG(extack, "Filter already exists"); | 1205 | NL_SET_ERR_MSG(extack, "Filter already exists"); |
1205 | err = -EEXIST; | 1206 | err = -EEXIST; |
1206 | goto errout; | 1207 | goto errout; |
@@ -1214,7 +1215,7 @@ replay: | |||
1214 | goto errout; | 1215 | goto errout; |
1215 | if (last) { | 1216 | if (last) { |
1216 | tcf_chain_tp_remove(chain, &chain_info, tp); | 1217 | tcf_chain_tp_remove(chain, &chain_info, tp); |
1217 | tcf_proto_destroy(tp); | 1218 | tcf_proto_destroy(tp, extack); |
1218 | } | 1219 | } |
1219 | goto errout; | 1220 | goto errout; |
1220 | case RTM_GETTFILTER: | 1221 | case RTM_GETTFILTER: |
@@ -1240,7 +1241,7 @@ replay: | |||
1240 | RTM_NEWTFILTER, false); | 1241 | RTM_NEWTFILTER, false); |
1241 | } else { | 1242 | } else { |
1242 | if (tp_created) | 1243 | if (tp_created) |
1243 | tcf_proto_destroy(tp); | 1244 | tcf_proto_destroy(tp, NULL); |
1244 | } | 1245 | } |
1245 | 1246 | ||
1246 | errout: | 1247 | errout: |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 6088be65d167..d333f5c5101d 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -112,7 +112,7 @@ static void basic_delete_filter(struct rcu_head *head) | |||
112 | tcf_queue_work(&f->work); | 112 | tcf_queue_work(&f->work); |
113 | } | 113 | } |
114 | 114 | ||
115 | static void basic_destroy(struct tcf_proto *tp) | 115 | static void basic_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
116 | { | 116 | { |
117 | struct basic_head *head = rtnl_dereference(tp->root); | 117 | struct basic_head *head = rtnl_dereference(tp->root); |
118 | struct basic_filter *f, *n; | 118 | struct basic_filter *f, *n; |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index c11e0fe23a17..a562b9a39e71 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -314,7 +314,8 @@ static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last, | |||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | static void cls_bpf_destroy(struct tcf_proto *tp) | 317 | static void cls_bpf_destroy(struct tcf_proto *tp, |
318 | struct netlink_ext_ack *extack) | ||
318 | { | 319 | { |
319 | struct cls_bpf_head *head = rtnl_dereference(tp->root); | 320 | struct cls_bpf_head *head = rtnl_dereference(tp->root); |
320 | struct cls_bpf_prog *prog, *tmp; | 321 | struct cls_bpf_prog *prog, *tmp; |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 1b54fbfca414..762da5c0cf5e 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -143,7 +143,8 @@ errout: | |||
143 | return err; | 143 | return err; |
144 | } | 144 | } |
145 | 145 | ||
146 | static void cls_cgroup_destroy(struct tcf_proto *tp) | 146 | static void cls_cgroup_destroy(struct tcf_proto *tp, |
147 | struct netlink_ext_ack *extack) | ||
147 | { | 148 | { |
148 | struct cls_cgroup_head *head = rtnl_dereference(tp->root); | 149 | struct cls_cgroup_head *head = rtnl_dereference(tp->root); |
149 | 150 | ||
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 64c24b488058..cd5fe383afdd 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -600,7 +600,7 @@ static int flow_init(struct tcf_proto *tp) | |||
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | 602 | ||
603 | static void flow_destroy(struct tcf_proto *tp) | 603 | static void flow_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
604 | { | 604 | { |
605 | struct flow_head *head = rtnl_dereference(tp->root); | 605 | struct flow_head *head = rtnl_dereference(tp->root); |
606 | struct flow_filter *f, *next; | 606 | struct flow_filter *f, *next; |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 727c10378f37..213be0e6f1d1 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -315,7 +315,7 @@ static void fl_destroy_rcu(struct rcu_head *rcu) | |||
315 | schedule_work(&head->work); | 315 | schedule_work(&head->work); |
316 | } | 316 | } |
317 | 317 | ||
318 | static void fl_destroy(struct tcf_proto *tp) | 318 | static void fl_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
319 | { | 319 | { |
320 | struct cls_fl_head *head = rtnl_dereference(tp->root); | 320 | struct cls_fl_head *head = rtnl_dereference(tp->root); |
321 | struct cls_fl_filter *f, *next; | 321 | struct cls_fl_filter *f, *next; |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 94d159a8869a..8b207723fbc2 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -149,7 +149,7 @@ static void fw_delete_filter(struct rcu_head *head) | |||
149 | tcf_queue_work(&f->work); | 149 | tcf_queue_work(&f->work); |
150 | } | 150 | } |
151 | 151 | ||
152 | static void fw_destroy(struct tcf_proto *tp) | 152 | static void fw_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
153 | { | 153 | { |
154 | struct fw_head *head = rtnl_dereference(tp->root); | 154 | struct fw_head *head = rtnl_dereference(tp->root); |
155 | struct fw_filter *f; | 155 | struct fw_filter *f; |
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index d990d2a52c6d..2de2338f4030 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c | |||
@@ -114,7 +114,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp, | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | static void mall_destroy(struct tcf_proto *tp) | 117 | static void mall_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
118 | { | 118 | { |
119 | struct cls_mall_head *head = rtnl_dereference(tp->root); | 119 | struct cls_mall_head *head = rtnl_dereference(tp->root); |
120 | 120 | ||
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 55467c30d524..21a03a8ee029 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -281,7 +281,7 @@ static void route4_delete_filter(struct rcu_head *head) | |||
281 | tcf_queue_work(&f->work); | 281 | tcf_queue_work(&f->work); |
282 | } | 282 | } |
283 | 283 | ||
284 | static void route4_destroy(struct tcf_proto *tp) | 284 | static void route4_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
285 | { | 285 | { |
286 | struct route4_head *head = rtnl_dereference(tp->root); | 286 | struct route4_head *head = rtnl_dereference(tp->root); |
287 | int h1, h2; | 287 | int h1, h2; |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 5cc0df690cff..4f1297657c27 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -322,7 +322,7 @@ static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) | |||
322 | __rsvp_delete_filter(f); | 322 | __rsvp_delete_filter(f); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void rsvp_destroy(struct tcf_proto *tp) | 325 | static void rsvp_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
326 | { | 326 | { |
327 | struct rsvp_head *data = rtnl_dereference(tp->root); | 327 | struct rsvp_head *data = rtnl_dereference(tp->root); |
328 | int h1, h2; | 328 | int h1, h2; |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 01a163e0b6aa..b49cc990a000 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -581,7 +581,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) | |||
581 | } | 581 | } |
582 | } | 582 | } |
583 | 583 | ||
584 | static void tcindex_destroy(struct tcf_proto *tp) | 584 | static void tcindex_destroy(struct tcf_proto *tp, |
585 | struct netlink_ext_ack *extack) | ||
585 | { | 586 | { |
586 | struct tcindex_data *p = rtnl_dereference(tp->root); | 587 | struct tcindex_data *p = rtnl_dereference(tp->root); |
587 | struct tcf_walker walker; | 588 | struct tcf_walker walker; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 7030240f8826..98cabe835fd8 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -638,7 +638,7 @@ static bool ht_empty(struct tc_u_hnode *ht) | |||
638 | return true; | 638 | return true; |
639 | } | 639 | } |
640 | 640 | ||
641 | static void u32_destroy(struct tcf_proto *tp) | 641 | static void u32_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) |
642 | { | 642 | { |
643 | struct tc_u_common *tp_c = tp->data; | 643 | struct tc_u_common *tp_c = tp->data; |
644 | struct tc_u_hnode *root_ht = rtnl_dereference(tp->root); | 644 | struct tc_u_hnode *root_ht = rtnl_dereference(tp->root); |