netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Ander Juaristi <a@juaristi.eus>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nft_dynset: support for element deletion
Date: Mon, 15 Jul 2019 21:54:05 +0200	[thread overview]
Message-ID: <20190715195405.q26aslzk54kfwh4d@breakpoint.cc> (raw)
In-Reply-To: <3db3e09d-5e1e-5d12-0f96-f911eb40c769@juaristi.eus>

Ander Juaristi <a@juaristi.eus> wrote:
> On 13/7/19 18:59, Florian Westphal wrote:
> > 
> >> +	if (he == NULL)
> >> +		return false;
> >> +
> >> +	rhashtable_remove_fast(&priv->ht, &he->node, nft_rhash_params);
> >> +	return true;
> > 
> > Perhaps add a small comment here that rhashtable_remove_fast retval
> > is ignored intentionally?
> > 
> > I.e., don't make this return false in case two cpus race to remove same
> > entry.
> 
> Hmm, this made me think. I don't know if this was all too intentional
> from me.
> 
> Maybe rather than ignoring it, it would be better to return true only if
> rhashtable_remove_fast returned 0, which will only happen if the element
> was actually deleted (locking is done internally so two cpus cannot race
> in there). Else, if return value is -ENOENT, we should return false.
> 
> And taking this reasoning further, maybe the initial call to
> rhashtable_lookup wouldn't be needed either?

You need it to obtain he->node, no?

Wrt. retval, I might be overthinking it indeed, so making this
a "return rhashtable_remove_fast() == 0;" seems fine too, saves the
comment :-)

  reply	other threads:[~2019-07-15 19:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-13 16:03 [PATCH] netfilter: nft_dynset: support for element deletion Ander Juaristi
2019-07-13 16:59 ` Florian Westphal
2019-07-15 16:22   ` Ander Juaristi
2019-07-15 19:54     ` Florian Westphal [this message]
2019-08-08 20:41 ` kbuild test robot

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=20190715195405.q26aslzk54kfwh4d@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=a@juaristi.eus \
    --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;
as well as URLs for NNTP newsgroup(s).