diff mbox series

[net-next,01/19] netfilter: nft_set_rbtree: rename gc deactivate+erase function

Message ID 20231025212555.132775-2-pablo@netfilter.org
State Awaiting Upstream
Headers show
Series [net-next,01/19] netfilter: nft_set_rbtree: rename gc deactivate+erase function | expand

Commit Message

Pablo Neira Ayuso Oct. 25, 2023, 9:25 p.m. UTC
From: Florian Westphal <fw@strlen.de>

Next patch adds a cllaer that doesn't hold the priv->write lock and
will need a similar function.

Rename the existing function to make it clear that it can only
be used for opportunistic gc during insertion.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_set_rbtree.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 26, 2023, 1:30 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Pablo Neira Ayuso <pablo@netfilter.org>:

On Wed, 25 Oct 2023 23:25:37 +0200 you wrote:
> From: Florian Westphal <fw@strlen.de>
> 
> Next patch adds a cllaer that doesn't hold the priv->write lock and
> will need a similar function.
> 
> Rename the existing function to make it clear that it can only
> be used for opportunistic gc during insertion.
> 
> [...]

Here is the summary with links:
  - [net-next,01/19] netfilter: nft_set_rbtree: rename gc deactivate+erase function
    https://git.kernel.org/netdev/net-next/c/8079fc30f797
  - [net-next,02/19] netfilter: nft_set_rbtree: prefer sync gc to async worker
    https://git.kernel.org/netdev/net-next/c/7d259f021aaa
  - [net-next,03/19] netfilter: nf_tables: Open-code audit log call in nf_tables_getrule()
    https://git.kernel.org/netdev/net-next/c/8877393029e7
  - [net-next,04/19] netfilter: nf_tables: Introduce nf_tables_getrule_single()
    https://git.kernel.org/netdev/net-next/c/1578c3287719
  - [net-next,05/19] netfilter: nf_tables: Add locking for NFT_MSG_GETRULE_RESET requests
    https://git.kernel.org/netdev/net-next/c/3cb03edb4de3
  - [net-next,06/19] br_netfilter: use single forward hook for ip and arp
    https://git.kernel.org/netdev/net-next/c/ee6f05dcd672
  - [net-next,07/19] netfilter: conntrack: switch connlabels to atomic_t
    https://git.kernel.org/netdev/net-next/c/643d12603664
  - [net-next,08/19] netfilter: nf_tables: Drop pointless memset in nf_tables_dump_obj
    https://git.kernel.org/netdev/net-next/c/ff16111cc10c
  - [net-next,09/19] netfilter: nf_tables: Unconditionally allocate nft_obj_filter
    https://git.kernel.org/netdev/net-next/c/4279cc60b354
  - [net-next,10/19] netfilter: nf_tables: A better name for nft_obj_filter
    https://git.kernel.org/netdev/net-next/c/ecf49cad8070
  - [net-next,11/19] netfilter: nf_tables: Carry s_idx in nft_obj_dump_ctx
    https://git.kernel.org/netdev/net-next/c/2eda95cfa2fc
  - [net-next,12/19] netfilter: nf_tables: nft_obj_filter fits into cb->ctx
    https://git.kernel.org/netdev/net-next/c/5a893b9cdf6f
  - [net-next,13/19] netfilter: nf_tables: Carry reset boolean in nft_obj_dump_ctx
    https://git.kernel.org/netdev/net-next/c/a552339063d3
  - [net-next,14/19] netfilter: nft_set_pipapo: no need to call pipapo_deactivate() from flush
    https://git.kernel.org/netdev/net-next/c/26cec9d4144e
  - [net-next,15/19] netfilter: nf_tables: set backend .flush always succeeds
    https://git.kernel.org/netdev/net-next/c/6509a2e410c3
  - [net-next,16/19] netfilter: nf_tables: expose opaque set element as struct nft_elem_priv
    https://git.kernel.org/netdev/net-next/c/9dad402b89e8
  - [net-next,17/19] netfilter: nf_tables: shrink memory consumption of set elements
    https://git.kernel.org/netdev/net-next/c/0e1ea651c971
  - [net-next,18/19] netfilter: nf_tables: set->ops->insert returns opaque set element in case of EEXIST
    https://git.kernel.org/netdev/net-next/c/078996fcd657
  - [net-next,19/19] netfilter: nf_tables: Carry reset boolean in nft_set_dump_ctx
    https://git.kernel.org/netdev/net-next/c/9cdee0634769

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index e34662f4a71e..d59be2bc6e6c 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -221,14 +221,15 @@  static void *nft_rbtree_get(const struct net *net, const struct nft_set *set,
 	return rbe;
 }
 
-static void nft_rbtree_gc_remove(struct net *net, struct nft_set *set,
-				 struct nft_rbtree *priv,
-				 struct nft_rbtree_elem *rbe)
+static void nft_rbtree_gc_elem_remove(struct net *net, struct nft_set *set,
+				      struct nft_rbtree *priv,
+				      struct nft_rbtree_elem *rbe)
 {
 	struct nft_set_elem elem = {
 		.priv	= rbe,
 	};
 
+	lockdep_assert_held_write(&priv->lock);
 	nft_setelem_data_deactivate(net, set, &elem);
 	rb_erase(&rbe->node, &priv->root);
 }
@@ -263,7 +264,7 @@  nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv,
 	rbe_prev = NULL;
 	if (prev) {
 		rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);
-		nft_rbtree_gc_remove(net, set, priv, rbe_prev);
+		nft_rbtree_gc_elem_remove(net, set, priv, rbe_prev);
 
 		/* There is always room in this trans gc for this element,
 		 * memory allocation never actually happens, hence, the warning
@@ -277,7 +278,7 @@  nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv,
 		nft_trans_gc_elem_add(gc, rbe_prev);
 	}
 
-	nft_rbtree_gc_remove(net, set, priv, rbe);
+	nft_rbtree_gc_elem_remove(net, set, priv, rbe);
 	gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC);
 	if (WARN_ON_ONCE(!gc))
 		return ERR_PTR(-ENOMEM);