@@ -525,21 +525,6 @@ clean_from_lists(struct nf_conn *ct)
525525 nf_ct_remove_expectations (ct );
526526}
527527
528- /* must be called with local_bh_disable */
529- static void nf_ct_add_to_dying_list (struct nf_conn * ct )
530- {
531- struct ct_pcpu * pcpu ;
532-
533- /* add this conntrack to the (per cpu) dying list */
534- ct -> cpu = smp_processor_id ();
535- pcpu = per_cpu_ptr (nf_ct_net (ct )-> ct .pcpu_lists , ct -> cpu );
536-
537- spin_lock (& pcpu -> lock );
538- hlist_nulls_add_head (& ct -> tuplehash [IP_CT_DIR_ORIGINAL ].hnnode ,
539- & pcpu -> dying );
540- spin_unlock (& pcpu -> lock );
541- }
542-
543528/* must be called with local_bh_disable */
544529static void nf_ct_add_to_unconfirmed_list (struct nf_conn * ct )
545530{
@@ -556,11 +541,11 @@ static void nf_ct_add_to_unconfirmed_list(struct nf_conn *ct)
556541}
557542
558543/* must be called with local_bh_disable */
559- static void nf_ct_del_from_dying_or_unconfirmed_list (struct nf_conn * ct )
544+ static void nf_ct_del_from_unconfirmed_list (struct nf_conn * ct )
560545{
561546 struct ct_pcpu * pcpu ;
562547
563- /* We overload first tuple to link into unconfirmed or dying list.*/
548+ /* We overload first tuple to link into unconfirmed list.*/
564549 pcpu = per_cpu_ptr (nf_ct_net (ct )-> ct .pcpu_lists , ct -> cpu );
565550
566551 spin_lock (& pcpu -> lock );
@@ -648,7 +633,8 @@ void nf_ct_destroy(struct nf_conntrack *nfct)
648633 */
649634 nf_ct_remove_expectations (ct );
650635
651- nf_ct_del_from_dying_or_unconfirmed_list (ct );
636+ if (unlikely (!nf_ct_is_confirmed (ct )))
637+ nf_ct_del_from_unconfirmed_list (ct );
652638
653639 local_bh_enable ();
654640
@@ -686,7 +672,6 @@ static void nf_ct_delete_from_lists(struct nf_conn *ct)
686672 local_bh_disable ();
687673
688674 __nf_ct_delete_from_lists (ct );
689- nf_ct_add_to_dying_list (ct );
690675
691676 local_bh_enable ();
692677}
@@ -700,8 +685,6 @@ static void nf_ct_add_to_ecache_list(struct nf_conn *ct)
700685 hlist_nulls_add_head_rcu (& ct -> tuplehash [IP_CT_DIR_ORIGINAL ].hnnode ,
701686 & cnet -> ecache .dying_list );
702687 spin_unlock (& cnet -> ecache .dying_lock );
703- #else
704- nf_ct_add_to_dying_list (ct );
705688#endif
706689}
707690
@@ -995,7 +978,6 @@ static void __nf_conntrack_insert_prepare(struct nf_conn *ct)
995978 struct nf_conn_tstamp * tstamp ;
996979
997980 refcount_inc (& ct -> ct_general .use );
998- ct -> status |= IPS_CONFIRMED ;
999981
1000982 /* set conntrack timestamp, if enabled. */
1001983 tstamp = nf_conn_tstamp_find (ct );
@@ -1024,7 +1006,6 @@ static int __nf_ct_resolve_clash(struct sk_buff *skb,
10241006 nf_conntrack_get (& ct -> ct_general );
10251007
10261008 nf_ct_acct_merge (ct , ctinfo , loser_ct );
1027- nf_ct_add_to_dying_list (loser_ct );
10281009 nf_ct_put (loser_ct );
10291010 nf_ct_set (skb , ct , ctinfo );
10301011
@@ -1157,7 +1138,6 @@ nf_ct_resolve_clash(struct sk_buff *skb, struct nf_conntrack_tuple_hash *h,
11571138 return ret ;
11581139
11591140drop :
1160- nf_ct_add_to_dying_list (loser_ct );
11611141 NF_CT_STAT_INC (net , drop );
11621142 NF_CT_STAT_INC (net , insert_failed );
11631143 return NF_DROP ;
@@ -1224,10 +1204,10 @@ __nf_conntrack_confirm(struct sk_buff *skb)
12241204 * user context, else we insert an already 'dead' hash, blocking
12251205 * further use of that particular connection -JM.
12261206 */
1227- nf_ct_del_from_dying_or_unconfirmed_list (ct );
1207+ nf_ct_del_from_unconfirmed_list (ct );
1208+ ct -> status |= IPS_CONFIRMED ;
12281209
12291210 if (unlikely (nf_ct_is_dying (ct ))) {
1230- nf_ct_add_to_dying_list (ct );
12311211 NF_CT_STAT_INC (net , insert_failed );
12321212 goto dying ;
12331213 }
@@ -1251,7 +1231,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
12511231 goto out ;
12521232 if (chainlen ++ > max_chainlen ) {
12531233chaintoolong :
1254- nf_ct_add_to_dying_list (ct );
12551234 NF_CT_STAT_INC (net , chaintoolong );
12561235 NF_CT_STAT_INC (net , insert_failed );
12571236 ret = NF_DROP ;
@@ -2800,7 +2779,6 @@ void nf_conntrack_init_end(void)
28002779 * We need to use special "null" values, not used in hash table
28012780 */
28022781#define UNCONFIRMED_NULLS_VAL ((1<<30)+0)
2803- #define DYING_NULLS_VAL ((1<<30)+1)
28042782
28052783int nf_conntrack_init_net (struct net * net )
28062784{
@@ -2821,7 +2799,6 @@ int nf_conntrack_init_net(struct net *net)
28212799
28222800 spin_lock_init (& pcpu -> lock );
28232801 INIT_HLIST_NULLS_HEAD (& pcpu -> unconfirmed , UNCONFIRMED_NULLS_VAL );
2824- INIT_HLIST_NULLS_HEAD (& pcpu -> dying , DYING_NULLS_VAL );
28252802 }
28262803
28272804 net -> ct .stat = alloc_percpu (struct ip_conntrack_stat );
0 commit comments