All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ying Xue <ying.xue@windriver.com>, tgraf@suug.ch
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3] rhashtable: Fix race in rhashtable_destroy() and use regular work_struct
Date: Wed, 14 Jan 2015 16:25:50 +0300	[thread overview]
Message-ID: <54B66E5E.6010507@cogentembedded.com> (raw)
In-Reply-To: <1421228256-740-1-git-send-email-ying.xue@windriver.com>

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@windriver.com>
> Cc: Thomas Graf <tgraf@suug.ch>
> Acked-by: Thomas Graf <tgraf@suug.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

      reply	other threads:[~2015-01-14 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14  9:37 [PATCH net-next v3] rhashtable: Fix race in rhashtable_destroy() and use regular work_struct Ying Xue
2015-01-14 13:25 ` Sergei Shtylyov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B66E5E.6010507@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.