gfs2.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Alexander Aring <aahringo@redhat.com>
Cc: Network Development <netdev@vger.kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	kadlec@netfilter.org, fw@strlen.de, gfs2@lists.linux.dev,
	David Teigland <teigland@redhat.com>,
	tgraf@suug.ch
Subject: Re: nft_rhash_walk, rhashtable and resize event
Date: Sat, 16 Sep 2023 11:37:51 +0800	[thread overview]
Message-ID: <ZQUjD0liUnH+ykKY@gondor.apana.org.au> (raw)
In-Reply-To: <CAK-6q+ghZRxrWQg3k0x1-SofoxfVfObJMg8wZ3UUMM4CU2oiWg@mail.gmail.com>

On Fri, Sep 15, 2023 at 10:05:06AM -0400, Alexander Aring wrote:
>
> My question is here? Is that allowed to do because a resize event may
> change the order how to iterate over a rhashtable.

Walking over an rhashtable should be a last resort.  There is
no guarantee of stability.

If you skip entries after a resize then you may miss entries.

If you want a stable walk, allocate an extra 8 bytes and use
a linked list.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2023-09-16  3:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 14:05 nft_rhash_walk, rhashtable and resize event Alexander Aring
2023-09-16  3:37 ` Herbert Xu [this message]
2023-09-18 11:59   ` Pablo Neira Ayuso
2023-09-18 12:25     ` Herbert Xu
2023-09-18 12:38       ` Alexander Aring
2023-09-19  3:24         ` Herbert Xu

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=ZQUjD0liUnH+ykKY@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=aahringo@redhat.com \
    --cc=fw@strlen.de \
    --cc=gfs2@lists.linux.dev \
    --cc=kadlec@netfilter.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=teigland@redhat.com \
    --cc=tgraf@suug.ch \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).