From: Jan Kara Date: Thu, 26 Feb 2009 21:19:52 +0100 Subject: [Ocfs2-devel] Possible locking problem in DLM code Message-ID: <20090226201952.GA4002@duck.suse.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ocfs2-devel@oss.oracle.com Hi, with lockdep enabled, I get the warning below. I've verified it and it seems to be really correct - we acquire dlm->ast_lock and lockres->spinlock in different orders in dlm_queue_bast() and dlm_lockres_release_asm(). I'm not sure whether this can really lead to a deadlock and / or how to fix this... Honza ======================================================= [ INFO: possible circular locking dependency detected ] 2.6.29-rc3-default #7 ------------------------------------------------------- dlm_thread/3876 is trying to acquire lock: (&dlm->ast_lock){--..}, at: [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] but task is already holding lock: (&res->spinlock){--..}, at: [] dlm_thread+0x506/0x11fb [ocfs2_dlm] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&res->spinlock){--..}: [] add_lock_to_list+0x74/0xb3 [] __lock_acquire+0x1208/0x156e [] _atomic_dec_and_lock+0x14/0x34 [] lock_acquire+0x52/0x6c [] _atomic_dec_and_lock+0x14/0x34 [] _spin_lock+0x29/0x36 [] _atomic_dec_and_lock+0x14/0x34 [] _atomic_dec_and_lock+0x14/0x34 [] dlm_lockres_release_ast+0x20/0x9a [ocfs2_dlm] [] dlm_thread+0xe2b/0x11fb [ocfs2_dlm] [] autoremove_wake_function+0x0/0x2e [] trace_hardirqs_on_caller+0x115/0x138 [] dlm_thread+0x0/0x11fb [ocfs2_dlm] [] kthread+0x47/0x73 [] trace_hardirqs_on_thunk+0x3a/0x3f [] child_rip+0xa/0x20 [] restore_args+0x0/0x30 [] kthreadd+0x177/0x19c [] kthread+0x0/0x73 [] child_rip+0x0/0x20 [] 0xffffffffffffffff -> #0 (&dlm->ast_lock){--..}: [] print_circular_bug_tail+0x87/0xc7 [] print_circular_bug_header+0xcc/0xd3 [] __lock_acquire+0xee0/0x156e [] lock_acquire+0x52/0x6c [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] _spin_lock+0x29/0x36 [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] dlm_thread+0xa1e/0x11fb [ocfs2_dlm] [] autoremove_wake_function+0x0/0x2e [] trace_hardirqs_on_caller+0x115/0x138 [] dlm_thread+0x0/0x11fb [ocfs2_dlm] [] kthread+0x47/0x73 [] trace_hardirqs_on_thunk+0x3a/0x3f [] child_rip+0xa/0x20 [] restore_args+0x0/0x30 [] kthreadd+0x177/0x19c [] kthread+0x0/0x73 [] child_rip+0x0/0x20 [] 0xffffffffffffffff other info that might help us debug this: 1 lock held by dlm_thread/3876: #0: (&res->spinlock){--..}, at: [] dlm_thread+0x506/0x11fb [ocfs2_dlm] stack backtrace: Pid: 3876, comm: dlm_thread Not tainted 2.6.29-rc3-default #7 Call Trace: [] print_circular_bug_tail+0xbe/0xc7 [] print_circular_bug_header+0xcc/0xd3 [] __lock_acquire+0xee0/0x156e [] lock_acquire+0x52/0x6c [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] _spin_lock+0x29/0x36 [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] dlm_queue_bast+0x75/0x16c [ocfs2_dlm] [] dlm_thread+0xa1e/0x11fb [ocfs2_dlm] [] autoremove_wake_function+0x0/0x2e [] trace_hardirqs_on_caller+0x115/0x138 [] dlm_thread+0x0/0x11fb [ocfs2_dlm] [] kthread+0x47/0x73 [] trace_hardirqs_on_thunk+0x3a/0x3f [] child_rip+0xa/0x20 [] restore_args+0x0/0x30 [] kthreadd+0x177/0x19c [] kthread+0x0/0x73 [] child_rip+0x0/0x20 Honza