Skip to contentSkip to conversation

ipvs: use nf_ct_kill helper

PATCH Superseded Florian Westphal 2 participants 2 messages Aug 3, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 ipvs: use nf_ct_kill helper

Once timer is removed from nf_conn struct we cannot open-code the removal sequence like this anymore.

---
ipvs maintainers:

Alternatively I can do a 1:1 replacement of the del_timer() with a test_and_set_bit().

Please let me know if you would prefer this,

net/netfilter/ipvs/ip_vs_nfct.c +1 -12
index f04fd8d..69ce16e 100644
@@ -281,18 +281,7 @@ void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
 	h = nf_conntrack_find_get(cp->ipvs->net, &nf_ct_zone_dflt, &tuple);
 	if (h) {
 		ct = nf_ct_tuplehash_to_ctrack(h);
-		/* Show what happens instead of calling nf_ct_kill() */
-		if (del_timer(&ct->timeout)) {
-			IP_VS_DBG(7, "%s: ct=%p, deleted conntrack timer for tuple="
-				FMT_TUPLE "\n",
-				__func__, ct, ARG_TUPLE(&tuple));
-			if (ct->timeout.function)
-				ct->timeout.function(ct->timeout.data);
-		} else {
-			IP_VS_DBG(7, "%s: ct=%p, no conntrack timer for tuple="
-				FMT_TUPLE "\n",
-				__func__, ct, ARG_TUPLE(&tuple));
-		}
+		nf_ct_kill(ct);
 		nf_ct_put(ct);
 	} else {
 		IP_VS_DBG(7, "%s: no conntrack for tuple=" FMT_TUPLE "\n",
Signature · 1 line
2.7.3
maintainer
#1 lore raw

Hello,

Quoted 17 lines · Florian Westphal

Once timer is removed from nf_conn struct we cannot open-code the removal sequence like this anymore.

---
ipvs maintainers:

Alternatively I can do a 1:1 replacement of the del_timer() with a test_and_set_bit().

Please let me know if you would prefer this,

net/netfilter/ipvs/ip_vs_nfct.c +0 -0
index f04fd8d..69ce16e 100644

net/netfilter/ipvs/ip_vs_nfct.c void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) · line 285

Quoted 5 lines
net/netfilter/ipvs/ip_vs_nfct.c +0 -2
@@ -281,18 +281,7 @@ void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
 	h = nf_conntrack_find_get(cp->ipvs->net, &nf_ct_zone_dflt, &tuple);
 	if (h) {
 		ct = nf_ct_tuplehash_to_ctrack(h);
-		/* Show what happens instead of calling nf_ct_kill() */
-		if (del_timer(&ct->timeout)) {

May be it would be better to preserve the debug
messages, i.e. if we replace del_timer with nf_ct_kill and remove the ct->timeout.function call below. I assume nf_ct_kill still returns such bool result. Then the debug messages should not be affected, I think.

Quoted 16 lines
net/netfilter/ipvs/ip_vs_nfct.c +1 -10
-			IP_VS_DBG(7, "%s: ct=%p, deleted conntrack timer for tuple="
-				FMT_TUPLE "\n",
-				__func__, ct, ARG_TUPLE(&tuple));
-			if (ct->timeout.function)
-				ct->timeout.function(ct->timeout.data);
-		} else {
-			IP_VS_DBG(7, "%s: ct=%p, no conntrack timer for tuple="
-				FMT_TUPLE "\n",
-				__func__, ct, ARG_TUPLE(&tuple));
-		}
+		nf_ct_kill(ct);
 		nf_ct_put(ct);
 	} else {
 		IP_VS_DBG(7, "%s: no conntrack for tuple=" FMT_TUPLE "\n",
Signature · 1 line
2.7.3

Regards

--
Julian Anastasov <[email protected]>