From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f173.google.com ([209.85.192.173]:35306 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755862AbcLBETO (ORCPT ); Thu, 1 Dec 2016 23:19:14 -0500 Received: by mail-pf0-f173.google.com with SMTP id i88so50005408pfk.2 for ; Thu, 01 Dec 2016 20:19:14 -0800 (PST) Received: from zzz (c-73-239-167-150.hsd1.wa.comcast.net. [73.239.167.150]) by smtp.gmail.com with ESMTPSA id a24sm3418727pfh.57.2016.12.01.20.19.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 20:19:13 -0800 (PST) Date: Thu, 1 Dec 2016 20:19:11 -0800 From: Eric Biggers To: linux-btrfs@vger.kernel.org Subject: btrfs lockdep warning: possible recursive locking of &ei->log_mutex Message-ID: <20161202041911.GA1228@zzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-btrfs-owner@vger.kernel.org List-ID: When using btrfs and a kernel with lockdep enabled (4.9-rc7, but this easily could have been there for a while) I got the following lockdep warning: [ 37.796703] ============================================= [ 37.796773] [ INFO: possible recursive locking detected ] [ 37.796854] 4.9.0-rc7 #351 Tainted: G L [ 37.796917] --------------------------------------------- [ 37.796986] systemd-journal/280 is trying to acquire lock: [ 37.797051] ( [ 37.797077] &ei->log_mutex [ 37.797119] ){+.+...} [ 37.797135] , at: [ 37.797176] [] btrfs_log_inode+0x33d/0x20a0 [ 37.797254] but task is already holding lock: [ 37.797328] ( [ 37.797353] &ei->log_mutex [ 37.797396] ){+.+...} [ 37.797411] , at: [ 37.797449] [] btrfs_log_inode+0x33d/0x20a0 [ 37.797521] other info that might help us debug this: [ 37.797603] Possible unsafe locking scenario: [ 37.797682] CPU0 [ 37.797717] ---- [ 37.797751] lock( [ 37.797782] &ei->log_mutex [ 37.797822] ); [ 37.797848] lock( [ 37.797878] &ei->log_mutex [ 37.797920] ); [ 37.797946] *** DEADLOCK *** [ 37.798020] May be due to missing lock nesting notation [ 37.798120] 3 locks held by systemd-journal/280: [ 37.798180] #0: [ 37.798208] ( [ 37.798238] &sb->s_type->i_mutex_key [ 37.798269] #9 [ 37.798299] ){+.+.+.} [ 37.798315] , at: [ 37.798354] [] btrfs_sync_file+0x1b1/0x990 [ 37.798425] #1: [ 37.798453] ( [ 37.798483] sb_internal [ 37.798501] ){.+.+.+} [ 37.798538] , at: [ 37.798553] [] start_transaction+0x7bc/0xe60 [ 37.798632] #2: [ 37.798660] ( [ 37.798690] &ei->log_mutex [ 37.798711] ){+.+...} [ 37.798747] , at: [ 37.798763] [] btrfs_log_inode+0x33d/0x20a0 [ 37.798840] stack backtrace: [ 37.798902] CPU: 2 PID: 280 Comm: systemd-journal Tainted: G L 4.9.0-rc7 #351 [ 37.799017] Hardware name: Dell Inc. Inspiron 15-7568/0M5YMV, BIOS 01.00.00 08/07/2015 [ 37.799111] ffff880213ca72d0 ffffffff81a1fe82 ffffffff84056000 ffffffff83a98ae0 [ 37.799230] ffff880213ca7498 ffffffff811f43c1 dffffc0000000000 ffff88021470cf20 [ 37.799348] dffffc0000000000 ffffffff82fa15c0 ffff88021470cf00 1ffff10042794e72 [ 37.799465] Call Trace: [ 37.799522] [] dump_stack+0x68/0x96 [ 37.799591] [] __lock_acquire+0x1bd1/0x5290 [ 37.799670] [] ? debug_check_no_locks_freed+0x280/0x280 [ 37.799760] [] ? debug_check_no_locks_freed+0x280/0x280 [ 37.799849] [] ? mark_held_locks+0xc8/0x120 [ 37.799926] [] ? mark_held_locks+0xc8/0x120 [ 37.800001] [] ? __mutex_unlock_slowpath+0x221/0x420 [ 37.800088] [] lock_acquire+0xdd/0x190 [ 37.800160] [] ? btrfs_log_inode+0x33d/0x20a0 [ 37.800239] [] ? __ww_mutex_lock_interruptible+0x1500/0x1500 [ 37.800333] [] mutex_lock_nested+0xa4/0x7e0 [ 37.803435] [] ? btrfs_log_inode+0x33d/0x20a0 [ 37.806090] [] ? mutex_trylock+0x3f0/0x3f0 [ 37.808347] [] ? __btrfs_btree_balance_dirty+0xcf/0x1a0 [ 37.811207] [] ? btrfs_commit_inode_delayed_inode+0x23b/0x360 [ 37.814263] [] btrfs_log_inode+0x33d/0x20a0 [ 37.817343] [] ? iget5_locked+0x8f/0x3a0 [ 37.820420] [] ? _raw_spin_unlock+0x22/0x30 [ 37.823462] [] ? btrfs_i_callback+0x20/0x20 [ 37.826466] [] ? btrfs_log_changed_extents+0x15b0/0x15b0 [ 37.829300] [] ? release_extent_buffer+0x102/0x150 [ 37.832101] [] ? release_extent_buffer+0x102/0x150 [ 37.834628] [] ? free_extent_buffer+0xe2/0x220 [ 37.837466] [] ? btrfs_release_path+0x85/0x1b0 [ 37.840325] [] btrfs_log_inode+0x1723/0x20a0 [ 37.843265] [] ? btrfs_log_changed_extents+0x15b0/0x15b0 [ 37.846248] [] ? mutex_lock_nested+0x511/0x7e0 [ 37.849177] [] ? mark_held_locks+0xc8/0x120 [ 37.852120] [] ? __mutex_unlock_slowpath+0x221/0x420 [ 37.855053] [] ? __ww_mutex_lock_interruptible+0x1500/0x1500 [ 37.858013] [] btrfs_log_inode_parent+0x689/0x2280 [ 37.860982] [] ? btrfs_end_log_trans+0x70/0x70 [ 37.863918] [] ? dget_parent+0x91/0x350 [ 37.866855] [] ? dget_parent+0xa9/0x350 [ 37.869762] [] btrfs_log_dentry_safe+0x74/0xa0 [ 37.872650] [] btrfs_sync_file+0x54e/0x990 [ 37.875570] [] ? start_ordered_ops+0x20/0x20 [ 37.878502] [] ? syscall_trace_enter+0x289/0x7c0 [ 37.881140] [] ? start_ordered_ops+0x20/0x20 [ 37.883550] [] vfs_fsync_range+0xe8/0x280 [ 37.886026] [] do_fsync+0x38/0x60 [ 37.888499] [] ? SyS_syncfs+0xc0/0xc0 [ 37.891003] [] SyS_fsync+0xb/0x10 [ 37.893851] [] do_syscall_64+0x17c/0x420 [ 37.896879] [] entry_SYSCALL64_slow_path+0x25/0x25