netdev
[Top] [All Lists]

Re: [PATCH 2/9] PKT_SCHED: tc filter extension API

To: Thomas Graf <tgraf@xxxxxxx>
Subject: Re: [PATCH 2/9] PKT_SCHED: tc filter extension API
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Fri, 31 Dec 2004 15:18:49 +0100
Cc: jamal <hadi@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
In-reply-to: <20041231131039.GI32419@xxxxxxxxxxxxxx>
References: <20041230122652.GM32419@xxxxxxxxxxxxxx> <20041230123023.GO32419@xxxxxxxxxxxxxx> <1104467816.1049.181.camel@xxxxxxxxxxxxxxxx> <20041231131039.GI32419@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Thomas Graf wrote:
* jamal <1104467816.1049.181.camel@xxxxxxxxxxxxxxxx> 2004-12-30 23:36


Patrick pointed this in other email: the xchg is sort of defeated by the
else. Perhaps make  the second one xchg as well.

Agreed, I changed it to:

                struct tc_action *act;
                act = xchg(&dst->action, src->action);
                if (act)
                        tcf_action_destroy(act, TCA_ACT_UNBIND);

Am I missing something?

Yes, the xchg without locking is only right in case we don't have
an existing action that needs to be destroyed. Someone might still
be looking at the old action in a softirq. If you want to keep the
"lockless" variant, you need to call synchronize_net() before
tcf_action_destroy().

Regards
Patrick


<Prev in Thread] Current Thread [Next in Thread>