mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
netfilter: nft_set_rbtree: use read spinlock to avoid datapath contention
commit96b33300fb
upstream. rbtree GC does not modify the datastructure, instead it collects expired elements and it enqueues a GC transaction. Use a read spinlock instead to avoid data contention while GC worker is running. Fixes:f6c383b8c3
("netfilter: nf_tables: adapt set backend to use GC transaction API") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9af7dfb3c9
commit
2e6846b613
1 changed files with 2 additions and 4 deletions
|
@ -622,8 +622,7 @@ static void nft_rbtree_gc(struct work_struct *work)
|
|||
if (!gc)
|
||||
goto done;
|
||||
|
||||
write_lock_bh(&priv->lock);
|
||||
write_seqcount_begin(&priv->count);
|
||||
read_lock_bh(&priv->lock);
|
||||
for (node = rb_first(&priv->root); node != NULL; node = rb_next(node)) {
|
||||
|
||||
/* Ruleset has been updated, try later. */
|
||||
|
@ -673,8 +672,7 @@ static void nft_rbtree_gc(struct work_struct *work)
|
|||
gc = nft_trans_gc_catchall(gc, gc_seq);
|
||||
|
||||
try_later:
|
||||
write_seqcount_end(&priv->count);
|
||||
write_unlock_bh(&priv->lock);
|
||||
read_unlock_bh(&priv->lock);
|
||||
|
||||
if (gc)
|
||||
nft_trans_gc_queue_async_done(gc);
|
||||
|
|
Loading…
Reference in a new issue