[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMArcTWX8RP_E+txf9Rm1FHm82hTiMQRj5oWoyM7r8GWg_4Fag@mail.gmail.com>
Date: Wed, 4 Jul 2018 22:32:58 +0900
From: Taehee Yoo <ap420073@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: davem@...emloft.net, tgraf@...g.ch, netdev@...r.kernel.org,
Florian Westphal <fw@...len.de>,
Pablo Neira Ayuso <pablo@...filter.org>
Subject: Re: [PATCH] rhashtable: add restart routine in rhashtable_free_and_destroy()
2018-07-04 14:45 GMT+09:00 Herbert Xu <herbert@...dor.apana.org.au>:
> 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));
>
Thank you for reviewing!
> Good catch. But don't we need to call bucket_table_free on all
> the tables too rather than just the first table?
>
I haven't thought of it
It seems that all table should be freed.
I will test and send v2 patch.
Thanks!
> 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