From 4930bfe6abafe172d649d9ecbbfdceee07a9c651 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 28 Jun 2011 10:59:58 +0200 Subject: net-flip-lock-dep-thingy.patch ======================================================= [ INFO: possible circular locking dependency detected ] 3.0.0-rc3+ #26 ------------------------------------------------------- ip/1104 is trying to acquire lock: (local_softirq_lock){+.+...}, at: [] __local_lock+0x25/0x68 but task is already holding lock: (sk_lock-AF_INET){+.+...}, at: [] lock_sock+0x10/0x12 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (sk_lock-AF_INET){+.+...}: [] lock_acquire+0x103/0x12e [] lock_sock_nested+0x82/0x92 [] lock_sock+0x10/0x12 [] tcp_close+0x1b/0x355 [] inet_release+0xc3/0xcd [] sock_release+0x1f/0x74 [] sock_close+0x27/0x2b [] fput+0x11d/0x1e3 [] filp_close+0x70/0x7b [] sys_close+0xf8/0x13d [] system_call_fastpath+0x16/0x1b -> #0 (local_softirq_lock){+.+...}: [] __lock_acquire+0xacc/0xdc8 [] lock_acquire+0x103/0x12e [] _raw_spin_lock+0x3b/0x4a [] __local_lock+0x25/0x68 [] local_bh_disable+0x36/0x3b [] _raw_write_lock_bh+0x16/0x4f [] tcp_close+0x159/0x355 [] inet_release+0xc3/0xcd [] sock_release+0x1f/0x74 [] sock_close+0x27/0x2b [] fput+0x11d/0x1e3 [] filp_close+0x70/0x7b [] sys_close+0xf8/0x13d [] system_call_fastpath+0x16/0x1b other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_INET); lock(local_softirq_lock); lock(sk_lock-AF_INET); lock(local_softirq_lock); *** DEADLOCK *** 1 lock held by ip/1104: #0: (sk_lock-AF_INET){+.+...}, at: [] lock_sock+0x10/0x12 stack backtrace: Pid: 1104, comm: ip Not tainted 3.0.0-rc3+ #26 Call Trace: [] print_circular_bug+0x1f8/0x209 [] __lock_acquire+0xacc/0xdc8 [] ? __local_lock+0x25/0x68 [] lock_acquire+0x103/0x12e [] ? __local_lock+0x25/0x68 [] ? get_parent_ip+0x11/0x41 [] _raw_spin_lock+0x3b/0x4a [] ? __local_lock+0x25/0x68 [] ? get_parent_ip+0x28/0x41 [] __local_lock+0x25/0x68 [] local_bh_disable+0x36/0x3b [] ? lock_sock+0x10/0x12 [] _raw_write_lock_bh+0x16/0x4f [] tcp_close+0x159/0x355 [] inet_release+0xc3/0xcd [] sock_release+0x1f/0x74 [] sock_close+0x27/0x2b [] fput+0x11d/0x1e3 [] filp_close+0x70/0x7b [] sys_close+0xf8/0x13d [] system_call_fastpath+0x16/0x1b Signed-off-by: Thomas Gleixner diff --git a/net/core/sock.c b/net/core/sock.c index ec228a3..410bb4c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2339,12 +2339,11 @@ void lock_sock_nested(struct sock *sk, int subclass) if (sk->sk_lock.owned) __lock_sock(sk); sk->sk_lock.owned = 1; - spin_unlock(&sk->sk_lock.slock); + spin_unlock_bh(&sk->sk_lock.slock); /* * The sk_lock has mutex_lock() semantics here: */ mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); - local_bh_enable(); } EXPORT_SYMBOL(lock_sock_nested); -- cgit v0.10.2