Skip to contentSkip to conversation

netfilter: conntrack: init all_locks to avoid debug warning

PATCH Applied Florian Westphal 2 participants 4 messages Apr 23, 2016 – Apr 29, 2016

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: conntrack: init all_locks to avoid debug warning

Else we get 'BUG: spinlock bad magic on CPU#' on resize when spin lock debugging is enabled.

---
 net/netfilter/nf_conntrack_core.c | 2 ++
 1 file changed, 2 insertions(+)
net/netfilter/nf_conntrack_core.c +2 -0
index afde5f5..2bbb962 100644
@@ -1659,6 +1659,8 @@ int nf_conntrack_init_start(void)
 	for (i = 0; i < CONNTRACK_LOCKS; i++)
 		spin_lock_init(&nf_conntrack_locks[i]);
 
+	spin_lock_init(&nf_conntrack_locks_all_lock);
+
 	if (!nf_conntrack_htable_size) {
 		/* Idea from tcp.c: use 1/16384 of memory.
 		 * On i386: 32MB machine has 512 buckets.
Signature · 1 line
2.7.3
maintainer Applied
#1 lore raw
Quoted 2 lines · Florian Westphal

Else we get 'BUG: spinlock bad magic on CPU#' on resize when spin lock debugging is enabled.

Applied, thanks Florian.

#2 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal

Else we get 'BUG: spinlock bad magic on CPU#' on resize when spin lock debugging is enabled.

Applied, thanks Florian.

Wait, probably better this?

commit 70d72b7e060e0a16b9ded9d0fbd3dff109743de3

Author: Florian Westphal <[email protected]>
Date:   Sun Apr 24 01:17:14 2016 +0200

netfilter: conntrack: init all_locks to avoid debug warning

Else we get 'BUG: spinlock bad magic on CPU#' on resize when spin lock debugging is enabled.

net/netfilter/nf_conntrack_core.c +1 -1
index afde5f5..895d11d 100644
@@ -66,7 +66,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_locks);
 __cacheline_aligned_in_smp DEFINE_SPINLOCK(nf_conntrack_expect_lock);
 EXPORT_SYMBOL_GPL(nf_conntrack_expect_lock);
 
-static __read_mostly spinlock_t nf_conntrack_locks_all_lock;
+static __read_mostly DEFINE_SPINLOCK(nf_conntrack_locks_all_lock);
 static __read_mostly bool nf_conntrack_locks_all;
 
 void nf_conntrack_lock(spinlock_t *lock) __acquires(lock)
author maintainer
#3 lore raw
Quoted 8 lines · Pablo Neira Ayuso
Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal

Else we get 'BUG: spinlock bad magic on CPU#' on resize when spin lock debugging is enabled.

Applied, thanks Florian.

Wait, probably better this?

I have no preference, either patch works for me.