* [PATCH] net: sched: cls_cgroup tear down exts and ematch from rcu callback
@ 2014-10-03 16:33 John Fastabend
2014-10-06 1:31 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: John Fastabend @ 2014-10-03 16:33 UTC (permalink / raw)
To: xiyou.wangcong, davem; +Cc: netdev, jhs, eric.dumazet
It is not RCU safe to destroy the action chain while there
is a possibility of readers accessing it. Move this code
into the rcu callback using the same rcu callback used in the
code patch to make a change to head.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/sched/cls_cgroup.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index d4fef3a..dead710 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
struct cls_cgroup_head *head = rtnl_dereference(tp->root);
if (head) {
- tcf_exts_destroy(&head->exts);
- tcf_em_tree_destroy(head->net, &head->ematches);
RCU_INIT_POINTER(tp->root, NULL);
- kfree_rcu(head, rcu);
+ call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] net: sched: cls_cgroup tear down exts and ematch from rcu callback
2014-10-03 16:33 [PATCH] net: sched: cls_cgroup tear down exts and ematch from rcu callback John Fastabend
@ 2014-10-06 1:31 ` David Miller
2014-10-06 1:48 ` John Fastabend
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-10-06 1:31 UTC (permalink / raw)
To: john.fastabend; +Cc: xiyou.wangcong, netdev, jhs, eric.dumazet
From: John Fastabend <john.fastabend@gmail.com>
Date: Fri, 03 Oct 2014 09:33:35 -0700
> It is not RCU safe to destroy the action chain while there
> is a possibility of readers accessing it. Move this code
> into the rcu callback using the same rcu callback used in the
> code patch to make a change to head.
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
...
> @@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
> struct cls_cgroup_head *head = rtnl_dereference(tp->root);
>
> if (head) {
> - tcf_exts_destroy(&head->exts);
> - tcf_em_tree_destroy(head->net, &head->ematches);
> RCU_INIT_POINTER(tp->root, NULL);
> - kfree_rcu(head, rcu);
> + call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
> }
tcf_em_tree_destroy() takes head->tp as it's first argument in my
net-next tree, maybe you need to respin this?
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] net: sched: cls_cgroup tear down exts and ematch from rcu callback
2014-10-06 1:31 ` David Miller
@ 2014-10-06 1:48 ` John Fastabend
0 siblings, 0 replies; 3+ messages in thread
From: John Fastabend @ 2014-10-06 1:48 UTC (permalink / raw)
To: David Miller; +Cc: xiyou.wangcong, netdev, jhs, eric.dumazet
On 10/05/2014 06:31 PM, David Miller wrote:
> From: John Fastabend <john.fastabend@gmail.com>
> Date: Fri, 03 Oct 2014 09:33:35 -0700
>
>> It is not RCU safe to destroy the action chain while there
>> is a possibility of readers accessing it. Move this code
>> into the rcu callback using the same rcu callback used in the
>> code patch to make a change to head.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ...
>> @@ -156,10 +156,8 @@ static void cls_cgroup_destroy(struct tcf_proto *tp)
>> struct cls_cgroup_head *head = rtnl_dereference(tp->root);
>>
>> if (head) {
>> - tcf_exts_destroy(&head->exts);
>> - tcf_em_tree_destroy(head->net, &head->ematches);
>> RCU_INIT_POINTER(tp->root, NULL);
>> - kfree_rcu(head, rcu);
>> + call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
>> }
>
> tcf_em_tree_destroy() takes head->tp as it's first argument in my
> net-next tree, maybe you need to respin this?
>
Yep, I'll respin this now sorry about that got a bit out of sync.
Thanks!
--
John Fastabend Intel Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-06 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03 16:33 [PATCH] net: sched: cls_cgroup tear down exts and ematch from rcu callback John Fastabend
2014-10-06 1:31 ` David Miller
2014-10-06 1:48 ` John Fastabend
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).