Skip to contentSkip to conversation

2.6.9-mm1

DISCUSSION Rusty Russell 1 participant 1 message Oct 27, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Andrew Morton

Another CONNTRACK_STAT_INC in preemptible code (destroy_conntrack).

What to do?

Tempting as it is to tell you to ask the person who wrote this code...

Name: Avoid warning on CONNTRACK_STAT_INC in destroy_conntrack()
Status: Trivial

ip_conntrack_put can be called in any context in theory: in particular, MASQUERADE will can call it (via ip_ct_selective_cleanup) when an interface comes up with a different address.

Move the CONNTRACK_STAT_INC inside the lock: it needs preemption disabled.

net/ipv4/netfilter/ip_conntrack_core.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .13939-linux-2.6-bk/net/ipv4/netfilter/ip_conntrack_core.c .13939-linux-2.6-bk.updated/net/ipv4/netfilter/ip_conntrack_core.c
@@ -312,6 +312,7 @@ destroy_conntrack(struct nf_conntrack *n
 		}
 		kmem_cache_free(ip_conntrack_expect_cachep, ct->master);
 	}
+	CONNTRACK_STAT_INC(delete);
 	WRITE_UNLOCK(&ip_conntrack_lock);
 
 	if (master)
@@ -320,7 +321,6 @@ destroy_conntrack(struct nf_conntrack *n
 	DEBUGP("destroy_conntrack: returning ct=%p to slab\n", ct);
 	kmem_cache_free(ip_conntrack_cachep, ct);
 	atomic_dec(&ip_conntrack_count);
-	CONNTRACK_STAT_INC(delete);
 }
 
 static void death_by_timeout(unsigned long ul_conntrack)