[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54B66E5E.6010507@cogentembedded.com>
Date: Wed, 14 Jan 2015 16:25:50 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Ying Xue <ying.xue@...driver.com>, tgraf@...g.ch
CC: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v3] rhashtable: Fix race in rhashtable_destroy()
and use regular work_struct
Hello.
On 1/14/2015 12:37 PM, Ying Xue wrote:
> When we put our declared work task in the global workqueue with
> schedule_delayed_work(), its delay parameter is always zero.
> Therefore, we should define a regular work in rhashtable structure
> instead of a delayed work.
> By the way, we add a condition to check whether resizing functions
> are NULL before cancel the work, avoiding to cancel an uninitialized
s/before cancel/before cancelling/.
> work.
[...]
> Fixes: 97defe1 ("rhashtable: Per bucket locks & deferred expansion/shrinking")
> Signed-off-by: Ying Xue <ying.xue@...driver.com>
> Cc: Thomas Graf <tgraf@...g.ch>
> Acked-by: Thomas Graf <tgraf@...g.ch>
[...]
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index ed6ae1a..1f56189 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
[...]
> @@ -911,12 +911,11 @@ EXPORT_SYMBOL_GPL(rhashtable_init);
> void rhashtable_destroy(struct rhashtable *ht)
> {
> ht->being_destroyed = true;
Empty line needed here.
> + if (ht->p.grow_decision || ht->p.shrink_decision)
> + cancel_work_sync(&ht->run_work);
>
> mutex_lock(&ht->mutex);
> -
> - cancel_delayed_work(&ht->run_work);
> bucket_table_free(rht_dereference(ht->tbl, ht));
> -
> mutex_unlock(&ht->mutex);
> }
> EXPORT_SYMBOL_GPL(rhashtable_destroy);
WBR, Sergei
--
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