Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netfilter-devel@vger.kernel.org, kadlec@netfilter.org,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH nf-next v4 01/13] rhashtable: add rhashtable_flush_and_free helper
Date: Tue, 8 Sep 2026 11:56:09 +0200	[thread overview]
Message-ID: <ap_budC8D-k4k67v@strlen.de> (raw)
In-Reply-To: <ap_PlDqTNOnB0Y83@gondor.apana.org.au>

Herbert Xu <herbert@gondor.apana.org.au> wrote:
> > I don't understand this response.  This isn't about rhashtable vs.
> > rhltable.  This is about my incompetence to flush an rhashtable or
> > rhashtable.  Simple version:
> > 
> >         rhashtable_walk_enter();
> >         rhashtable_walk_start();
> 
> You should never use rhashtable_walk for real work.  It was only ever
> intended for the very limited case of netlink dumping where stability
> or accuracy was not a requirement.
> 
> >         while ((he = rhashtable_walk_next())) {
> >                 if (IS_ERR(he)) {
> >                         if (PTR_ERR(he) != -EAGAIN) { ..  break; }
> >                         continue;
> >                 }
> > 
> > 		rhashtable_remove_fast()
> 
> So you want to free the entire table, right?

No, remove all elements. Concurrent insertion is not disabled.

> We already have rhashtable_free_and_destroy, any reason why it
> doesn't work?

It requires userspace or kernel don't add new elements.

AFAICS I can't "destroy, then re-init" without some external
mutex.  What I could do is add another indirection, i.e.

 struct htype {
-       struct rhashtable ht;   /* the hash table */
+       struct rhashtable *ht;   /* the hash table */
        struct net_prefixes __rcu *rnets[IPSET_NET_COUNT]; /* cidr prefixes */
 };

... and then alloc+init an new ht + free old one.
But its not nice either.

  reply	other threads:[~2026-09-08  9:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260904185321.30313-1-fw@strlen.de>
2026-09-04 18:53 ` [PATCH nf-next v4 01/13] rhashtable: add rhashtable_flush_and_free helper Florian Westphal
2026-09-04 19:29   ` Florian Westphal
2026-09-08  5:12   ` Herbert Xu
2026-09-08  5:30     ` Florian Westphal
2026-09-08  9:04       ` Herbert Xu
2026-09-08  9:56         ` Florian Westphal [this message]
2026-09-08 12:39           ` Herbert Xu
2026-09-08 13:25             ` Florian Westphal
2026-09-09  3:49               ` Herbert Xu
2026-09-09  4:17   ` Herbert Xu
2026-09-09 14:45     ` Florian Westphal
2026-09-10  9:11       ` Herbert Xu
2026-09-10 10:41         ` Florian Westphal
2026-09-11 11:56           ` Herbert Xu
2026-09-11 12:54             ` Florian Westphal

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=ap_budC8D-k4k67v@strlen.de \
    --to=fw@strlen.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=kadlec@netfilter.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox