[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180704054507.zo4nxai36lln54i5@gondor.apana.org.au>
Date: Wed, 4 Jul 2018 13:45:07 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Taehee Yoo <ap420073@...il.com>
Cc: davem@...emloft.net, tgraf@...g.ch, netdev@...r.kernel.org,
fw@...len.de, pablo@...filter.org
Subject: Re: [PATCH] rhashtable: add restart routine in
rhashtable_free_and_destroy()
On Tue, Jul 03, 2018 at 10:19:09PM +0900, Taehee Yoo wrote:
>
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index 0e04947..8ea27fa 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -1134,6 +1134,7 @@ void rhashtable_free_and_destroy(struct rhashtable *ht,
> mutex_lock(&ht->mutex);
> tbl = rht_dereference(ht->tbl, ht);
> if (free_fn) {
> +restart:
> for (i = 0; i < tbl->size; i++) {
> struct rhash_head *pos, *next;
>
> @@ -1147,9 +1148,11 @@ void rhashtable_free_and_destroy(struct rhashtable *ht,
> rht_dereference(pos->next, ht) : NULL)
> rhashtable_free_one(ht, pos, free_fn, arg);
> }
> + tbl = rht_dereference(tbl->future_tbl, ht);
> + if (tbl)
> + goto restart;
> }
> -
> - bucket_table_free(tbl);
> + bucket_table_free(rht_dereference(ht->tbl, ht));
Good catch. But don't we need to call bucket_table_free on all
the tables too rather than just the first table?
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists