[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100609104100.GB7308@ff.dom.local>
Date: Wed, 9 Jun 2010 10:41:00 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Changli Gao <xiaosuo@...il.com>,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Stephen Hemminger <shemminger@...tta.com>,
Patrick McHardy <kaber@...sh.net>
Subject: Re: [PATCH] pkt_sched: gen_kill_estimator() rcu fixes
On Wed, Jun 09, 2010 at 11:56:56AM +0200, Eric Dumazet wrote:
...
> Updated patch follows :
>
> [PATCH] pkt_sched: gen_kill_estimator() rcu fixes
>
> gen_kill_estimator() API is a bit misleading, since caller
I'd call it incomplete or simply buggy. Plus a tiny note below.
> should make sure an RCU grace period is respected before
> freeing stats_lock.
>
> This was partially addressed in commit 5d944c640b4
> (gen_estimator: deadlock fix), but same problem exist for all
> gen_kill_estimator() users, if lock they use is not already rcu
> protected.
>
> A code review shows xt_RATEEST.c, act_api.c, act_police.c have this
> problem. Other are ok because they use qdisc lock.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> ---
...
> diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
> index 69c01e1..096b18b 100644
> --- a/net/netfilter/xt_RATEEST.c
> +++ b/net/netfilter/xt_RATEEST.c
> @@ -60,13 +60,18 @@ struct xt_rateest *xt_rateest_lookup(const char *name)
> }
> EXPORT_SYMBOL_GPL(xt_rateest_lookup);
>
> +static void xt_rateeset_free_rcu(struct rcu_head *head)
> +{
> + kfree(container_of(head, struct xt_rateest, rcu));
> +}
> +
> void xt_rateest_put(struct xt_rateest *est)
> {
> mutex_lock(&xt_rateest_mutex);
> if (--est->refcnt == 0) {
> hlist_del(&est->list);
> gen_kill_estimator(&est->bstats, &est->rstats);
> - kfree(est);
> + call_rcu(&est->rcu, xt_rateeset_free_rcu);
Spelling suggestion: xt_rateest_free_rcu?
Since it's only 3 places I'd consider adding little comments,
who needs this call_rcu (like in qdisc_destroy).
Anyway this patch looks OK to me.
Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists