Skip to content

netfilter: nf_tables: rewrite gc again

Florian Westphal llvm netfilter-devel oe-kbuild-all 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9netfilter: nf_tables: warn if set being destroyed is still activenet/netfilter/nf_tables_api.c net/netfilter/nft_set_hash.c+5 -00 replies
2/9netfilter: nf_tables: decrement element counters on set removal/flushnet/netfilter/nf_tables_api.c net/netfilter/nft_set_bitmap.c net/netfilter/nft_set_hash.c +2 more+19 -10 replies
3/9netfilter: nf_tables: add lockdep assertion for chain use counternet/netfilter/nf_tables_api.c+20 -10 replies
4/9netfilter: remove nft_trans_gc_catchall_async handlinginclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c net/netfilter/nft_set_hash.c+47 -360 replies
5/9netfilter: nf_tables: condense catchall gcinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c net/netfilter/nft_set_pipapo.c +1 more+9 -280 replies
6/9netfilter: nf_tables: add in-kernel only query that will return expired/dead elementsinclude/uapi/linux/netfilter/nf_tables.h net/netfilter/nf_tables_api.c net/netfilter/nft_set_hash.c+22 -40 replies
7/9netfilter: nf_tables: prepare for key-based deletion from workqueueinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c net/netfilter/nft_set_hash.c+61 -90 replies
8/9netfilter: nf_tables: remove expired elements based on key lookup onlyinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c+24 -60 replies
9/9netfilter: nf_tables: remove gc sequence counterinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c net/netfilter/nft_set_hash.c +2 more+16 -760 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nf-next 0/9] netfilter: nf_tables: rewrite gc again

First couple of patches could be applied, as they add more warns/checks to the control plane.

Actual gc changes are not for merging, this is for archive only; I don't see a compelling reason at this time to do this.

The implemeneted strategy is to have the async gc (rhashtable) enqueue the *key* of *gc candidates*, rather than the actual expired elements.

Therefore no races with control plane are possible and the "gc sequence" can be removed.

If async gc enqueues element e and control plane removes it before gc has a chance to run, then gc will no longer find it -> no op.

If control plane removes and re-adds -> gc candidate is not expired -> no op.

Downside is the vast increase in memory (instead of just storing a pointer, we need to be able to store the max key size, i.e. 64 byte).

I'll mark most of this as RFC in patchwork so we can recover this work later if there is any issue with the exising gc mechanism that this approach would avoid.

Florian Westphal (9):
netfilter: nf_tables: warn if set being destroyed is still active
netfilter: nf_tables: decrement element counters on set removal/flush
netfilter: nf_tables: add lockdep assertion for chain use counter
netfilter: remove nft_trans_gc_catchall_async handling
netfilter: nf_tables: condense catchall gc
netfilter: nf_tables: add in-kernel only query that will return
expired/dead elements
netfilter: nf_tables: prepare for key-based deletion from workqueue
netfilter: nf_tables: remove expired elements based on key lookup only
netfilter: nf_tables: remove gc sequence counter

 include/net/netfilter/nf_tables.h        |  27 +--
 include/uapi/linux/netfilter/nf_tables.h |   5 +
 net/netfilter/nf_tables_api.c            | 280 ++++++++++++++---------
 net/netfilter/nft_set_bitmap.c           |   5 +-
 net/netfilter/nft_set_hash.c             |  39 ++--
 net/netfilter/nft_set_pipapo.c           |   6 +-
 net/netfilter/nft_set_rbtree.c           |   8 +-
 7 files changed, 216 insertions(+), 154 deletions(-)
Signature · 1 line
2.43.0