@@ -1914,7 +1914,6 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
19141914 goto err_hook_dev ;
19151915 }
19161916 hook -> ops .dev = dev ;
1917- hook -> inactive = false;
19181917
19191918 return hook ;
19201919
@@ -7618,6 +7617,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
76187617{
76197618 const struct nlattr * const * nla = ctx -> nla ;
76207619 struct nft_flowtable_hook flowtable_hook ;
7620+ LIST_HEAD (flowtable_del_list );
76217621 struct nft_hook * this , * hook ;
76227622 struct nft_trans * trans ;
76237623 int err ;
@@ -7633,7 +7633,7 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
76337633 err = - ENOENT ;
76347634 goto err_flowtable_del_hook ;
76357635 }
7636- hook -> inactive = true ;
7636+ list_move ( & hook -> list , & flowtable_del_list ) ;
76377637 }
76387638
76397639 trans = nft_trans_alloc (ctx , NFT_MSG_DELFLOWTABLE ,
@@ -7646,20 +7646,15 @@ static int nft_delflowtable_hook(struct nft_ctx *ctx,
76467646 nft_trans_flowtable (trans ) = flowtable ;
76477647 nft_trans_flowtable_update (trans ) = true;
76487648 INIT_LIST_HEAD (& nft_trans_flowtable_hooks (trans ));
7649+ list_splice (& flowtable_del_list , & nft_trans_flowtable_hooks (trans ));
76497650 nft_flowtable_hook_release (& flowtable_hook );
76507651
76517652 nft_trans_commit_list_add_tail (ctx -> net , trans );
76527653
76537654 return 0 ;
76547655
76557656err_flowtable_del_hook :
7656- list_for_each_entry (this , & flowtable_hook .list , list ) {
7657- hook = nft_hook_list_find (& flowtable -> hook_list , this );
7658- if (!hook )
7659- break ;
7660-
7661- hook -> inactive = false;
7662- }
7657+ list_splice (& flowtable_del_list , & flowtable -> hook_list );
76637658 nft_flowtable_hook_release (& flowtable_hook );
76647659
76657660 return err ;
@@ -8563,17 +8558,6 @@ void nft_chain_del(struct nft_chain *chain)
85638558 list_del_rcu (& chain -> list );
85648559}
85658560
8566- static void nft_flowtable_hooks_del (struct nft_flowtable * flowtable ,
8567- struct list_head * hook_list )
8568- {
8569- struct nft_hook * hook , * next ;
8570-
8571- list_for_each_entry_safe (hook , next , & flowtable -> hook_list , list ) {
8572- if (hook -> inactive )
8573- list_move (& hook -> list , hook_list );
8574- }
8575- }
8576-
85778561static void nf_tables_module_autoload_cleanup (struct net * net )
85788562{
85798563 struct nftables_pernet * nft_net = nft_pernet (net );
@@ -8918,8 +8902,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
89188902 break ;
89198903 case NFT_MSG_DELFLOWTABLE :
89208904 if (nft_trans_flowtable_update (trans )) {
8921- nft_flowtable_hooks_del (nft_trans_flowtable (trans ),
8922- & nft_trans_flowtable_hooks (trans ));
89238905 nf_tables_flowtable_notify (& trans -> ctx ,
89248906 nft_trans_flowtable (trans ),
89258907 & nft_trans_flowtable_hooks (trans ),
@@ -9000,7 +8982,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
90008982 struct nftables_pernet * nft_net = nft_pernet (net );
90018983 struct nft_trans * trans , * next ;
90028984 struct nft_trans_elem * te ;
9003- struct nft_hook * hook ;
90048985
90058986 if (action == NFNL_ABORT_VALIDATE &&
90068987 nf_tables_validate (net ) < 0 )
@@ -9131,8 +9112,8 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
91319112 break ;
91329113 case NFT_MSG_DELFLOWTABLE :
91339114 if (nft_trans_flowtable_update (trans )) {
9134- list_for_each_entry ( hook , & nft_trans_flowtable (trans )-> hook_list , list )
9135- hook -> inactive = false ;
9115+ list_splice ( & nft_trans_flowtable_hooks (trans ),
9116+ & nft_trans_flowtable ( trans ) -> hook_list ) ;
91369117 } else {
91379118 trans -> ctx .table -> use ++ ;
91389119 nft_clear (trans -> ctx .net , nft_trans_flowtable (trans ));
0 commit comments