Skip to content

Commit 653a52a

Browse files
committed
Fix soft lockup caused by deadlock on htable access
This appeared on kernels where xtables target is called though nftables. Lockdep message: WARNING: inconsistent lock state [ 292.286849] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. [ 292.287776] kworker/0:0/5 [HC0[0]:SC1[1]:HE1:SE0] takes: [ 292.288618] ffffffffc0de6a98 (&(&htable_stripes[i].lock)->rlock){+.?.}, at: netflow_target+0x604/0x4150 [ipt_NETFLOW] [ 292.290323] {SOFTIRQ-ON-W} state was registered at: [ 292.291095] lock_acquire+0x14f/0x3b0 [ 292.291679] _raw_spin_lock+0x30/0x70 [ 292.292276] netflow_target+0x604/0x4150 [ipt_NETFLOW] [ 292.293125] nft_target_eval_xt+0x11a/0x220 [nft_compat] [ 292.294027] nft_do_chain+0x25a/0x10e0 [nf_tables] [ 292.294813] nft_do_chain_ipv4+0x17e/0x200 [nf_tables] [ 292.295622] nf_hook_slow+0xb1/0x180 Non-debug kernel error message: watchdog: BUG: soft lockup - CPU#6 stuck for 22s! Fixes #141 and #145.
1 parent f02eae2 commit 653a52a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ipt_NETFLOW.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5238,7 +5238,7 @@ static unsigned int netflow_target(
52385238
#else /* !SAMPLING_HASH */
52395239
hash = hash_netflow(&tuple);
52405240
#endif
5241-
read_lock(&htable_rwlock);
5241+
read_lock_bh(&htable_rwlock);
52425242
stripe = &htable_stripes[hash & LOCK_COUNT_MASK];
52435243
spin_lock(&stripe->lock);
52445244
/* record */
@@ -5391,7 +5391,7 @@ static unsigned int netflow_target(
53915391

53925392
unlock_return:
53935393
spin_unlock(&stripe->lock);
5394-
read_unlock(&htable_rwlock);
5394+
read_unlock_bh(&htable_rwlock);
53955395

53965396
return IPT_CONTINUE;
53975397
}

0 commit comments

Comments
 (0)