Skip to content

Commit

Permalink
netfilter: nft_rbtree: no need for spinlock from set destroy path
Browse files Browse the repository at this point in the history
The sets are released from the rcu callback, after the rule is removed
from the chain list, which implies that nfnetlink cannot update the
rbtree and no packets are walking on the set anymore. Thus, we can get
rid of the spinlock in the set destroy path there.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Reviewied-by: Thomas Graf <tgraf@suug.ch>
  • Loading branch information
Pablo Neira Ayuso committed Sep 3, 2014
1 parent 39f3901 commit d99407f
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions net/netfilter/nft_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,11 @@ static void nft_rbtree_destroy(const struct nft_set *set)
struct nft_rbtree_elem *rbe;
struct rb_node *node;

spin_lock_bh(&nft_rbtree_lock);
while ((node = priv->root.rb_node) != NULL) {
rb_erase(node, &priv->root);
rbe = rb_entry(node, struct nft_rbtree_elem, node);
nft_rbtree_elem_destroy(set, rbe);
}
spin_unlock_bh(&nft_rbtree_lock);
}

static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features,
Expand Down

0 comments on commit d99407f

Please sign in to comment.