net: sched: propagate extack to cls->destroy callbacks
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 24 Jan 2018 20:54:13 +0000 (12:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jan 2018 21:01:09 +0000 (16:01 -0500)
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>
13 files changed:
include/net/sch_generic.h
net/sched/cls_api.c
net/sched/cls_basic.c
net/sched/cls_bpf.c
net/sched/cls_cgroup.c
net/sched/cls_flow.c
net/sched/cls_flower.c
net/sched/cls_fw.c
net/sched/cls_matchall.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c

index cd1be1f25c36a89667943784e012cb119b2a9bfc..eac43e8ca96da205b95fb903d8c596c2a75000d9 100644 (file)
@@ -233,7 +233,8 @@ struct tcf_proto_ops {
                                            const struct tcf_proto *,
                                            struct tcf_result *);
        int                     (*init)(struct tcf_proto*);
-       void                    (*destroy)(struct tcf_proto*);
+       void                    (*destroy)(struct tcf_proto *tp,
+                                          struct netlink_ext_ack *extack);
 
        void*                   (*get)(struct tcf_proto*, u32 handle);
        int                     (*change)(struct net *net, struct sk_buff *,
index f5d293416f46ac485e81365886619670ca7267ed..bcb4ccb5f894b8e50e6c7373a091aacf5b66a107 100644 (file)
@@ -172,9 +172,10 @@ errout:
        return ERR_PTR(err);
 }
 
-static void tcf_proto_destroy(struct tcf_proto *tp)
+static void tcf_proto_destroy(struct tcf_proto *tp,
+                             struct netlink_ext_ack *extack)
 {
-       tp->ops->destroy(tp);
+       tp->ops->destroy(tp, extack);
        module_put(tp->ops->owner);
        kfree_rcu(tp, rcu);
 }
@@ -223,7 +224,7 @@ static void tcf_chain_flush(struct tcf_chain *chain)
        tcf_chain_head_change(chain, NULL);
        while (tp) {
                RCU_INIT_POINTER(chain->filter_chain, tp->next);
-               tcf_proto_destroy(tp);
+               tcf_proto_destroy(tp, NULL);
                tp = rtnl_dereference(chain->filter_chain);
                tcf_chain_put(chain);
        }
@@ -1182,7 +1183,7 @@ replay:
                        tcf_chain_tp_remove(chain, &chain_info, tp);
                        tfilter_notify(net, skb, n, tp, block, q, parent, fh,
                                       RTM_DELTFILTER, false);
-                       tcf_proto_destroy(tp);
+                       tcf_proto_destroy(tp, extack);
                        err = 0;
                        goto errout;
                }
@@ -1200,7 +1201,7 @@ replay:
                case RTM_NEWTFILTER:
                        if (n->nlmsg_flags & NLM_F_EXCL) {
                                if (tp_created)
-                                       tcf_proto_destroy(tp);
+                                       tcf_proto_destroy(tp, NULL);
                                NL_SET_ERR_MSG(extack, "Filter already exists");
                                err = -EEXIST;
                                goto errout;
@@ -1214,7 +1215,7 @@ replay:
                                goto errout;
                        if (last) {
                                tcf_chain_tp_remove(chain, &chain_info, tp);
-                               tcf_proto_destroy(tp);
+                               tcf_proto_destroy(tp, extack);
                        }
                        goto errout;
                case RTM_GETTFILTER:
@@ -1240,7 +1241,7 @@ replay:
                               RTM_NEWTFILTER, false);
        } else {
                if (tp_created)
-                       tcf_proto_destroy(tp);
+                       tcf_proto_destroy(tp, NULL);
        }
 
 errout:
index 6088be65d1676475ab44313b3e77a4d1e882dc61..d333f5c5101d0d083588831f5c2f13f35299c05e 100644 (file)
@@ -112,7 +112,7 @@ static void basic_delete_filter(struct rcu_head *head)
        tcf_queue_work(&f->work);
 }
 
-static void basic_destroy(struct tcf_proto *tp)
+static void basic_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct basic_head *head = rtnl_dereference(tp->root);
        struct basic_filter *f, *n;
index c11e0fe23a179caca31a09426c87bd2a23365596..a562b9a39e71b56a1f8a3f14770ce8986cf18ef2 100644 (file)
@@ -314,7 +314,8 @@ static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last,
        return 0;
 }
 
-static void cls_bpf_destroy(struct tcf_proto *tp)
+static void cls_bpf_destroy(struct tcf_proto *tp,
+                           struct netlink_ext_ack *extack)
 {
        struct cls_bpf_head *head = rtnl_dereference(tp->root);
        struct cls_bpf_prog *prog, *tmp;
index 1b54fbfca414fe50bacd47a91eba6f97a7706f34..762da5c0cf5ea4b997a22325e16a98a4ae6e340c 100644 (file)
@@ -143,7 +143,8 @@ errout:
        return err;
 }
 
-static void cls_cgroup_destroy(struct tcf_proto *tp)
+static void cls_cgroup_destroy(struct tcf_proto *tp,
+                              struct netlink_ext_ack *extack)
 {
        struct cls_cgroup_head *head = rtnl_dereference(tp->root);
 
index 64c24b4880581b653db60fcaf9f195e18796008c..cd5fe383afddd1ee3e82690a996fcb1fb8957155 100644 (file)
@@ -600,7 +600,7 @@ static int flow_init(struct tcf_proto *tp)
        return 0;
 }
 
-static void flow_destroy(struct tcf_proto *tp)
+static void flow_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct flow_head *head = rtnl_dereference(tp->root);
        struct flow_filter *f, *next;
index 727c10378f37900c48057c72695834f7f7455e43..213be0e6f1d111fd96ce1b275430f6630e15d7e5 100644 (file)
@@ -315,7 +315,7 @@ static void fl_destroy_rcu(struct rcu_head *rcu)
        schedule_work(&head->work);
 }
 
-static void fl_destroy(struct tcf_proto *tp)
+static void fl_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct cls_fl_head *head = rtnl_dereference(tp->root);
        struct cls_fl_filter *f, *next;
index 94d159a8869ac952cedba68c4685496c6dacd8e2..8b207723fbc202523c3227bda80cae1002ea21a1 100644 (file)
@@ -149,7 +149,7 @@ static void fw_delete_filter(struct rcu_head *head)
        tcf_queue_work(&f->work);
 }
 
-static void fw_destroy(struct tcf_proto *tp)
+static void fw_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct fw_head *head = rtnl_dereference(tp->root);
        struct fw_filter *f;
index d990d2a52c6d67aa0708b8fbbe7a0bb0782f789d..2de2338f4030b8c9737d4a30731ae206afc9bc23 100644 (file)
@@ -114,7 +114,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
        return 0;
 }
 
-static void mall_destroy(struct tcf_proto *tp)
+static void mall_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct cls_mall_head *head = rtnl_dereference(tp->root);
 
index 55467c30d5245342e695b1080d93e036af59b353..21a03a8ee0296d1421d6816040bf2ca5fad129e8 100644 (file)
@@ -281,7 +281,7 @@ static void route4_delete_filter(struct rcu_head *head)
        tcf_queue_work(&f->work);
 }
 
-static void route4_destroy(struct tcf_proto *tp)
+static void route4_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct route4_head *head = rtnl_dereference(tp->root);
        int h1, h2;
index 5cc0df690cff6b98a43089e36b62a0d1284369f5..4f1297657c270edfdef7153f69e825ff4de0d264 100644 (file)
@@ -322,7 +322,7 @@ static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f)
                __rsvp_delete_filter(f);
 }
 
-static void rsvp_destroy(struct tcf_proto *tp)
+static void rsvp_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct rsvp_head *data = rtnl_dereference(tp->root);
        int h1, h2;
index 01a163e0b6aa2c3445f3705ff8eab999b55bb717..b49cc990a0002c3d9d38ac3cb93593ba721bc72a 100644 (file)
@@ -581,7 +581,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker)
        }
 }
 
-static void tcindex_destroy(struct tcf_proto *tp)
+static void tcindex_destroy(struct tcf_proto *tp,
+                           struct netlink_ext_ack *extack)
 {
        struct tcindex_data *p = rtnl_dereference(tp->root);
        struct tcf_walker walker;
index 7030240f8826c4ce7375cf0d64e21c176a022338..98cabe835fd81351629891932d189b17c3aa5959 100644 (file)
@@ -638,7 +638,7 @@ static bool ht_empty(struct tc_u_hnode *ht)
        return true;
 }
 
-static void u32_destroy(struct tcf_proto *tp)
+static void u32_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
 {
        struct tc_u_common *tp_c = tp->data;
        struct tc_u_hnode *root_ht = rtnl_dereference(tp->root);