lockdep warning in btrfs in 4.8-rc3

From: Christian Borntraeger
Date: Thu Sep 08 2016 - 07:48:14 EST


Chris,

with 4.8-rc3 I get the following on an s390 box:


[ 1094.009172] =============================================
[ 1094.009174] [ INFO: possible recursive locking detected ]
[ 1094.009177] 4.8.0-rc3 #126 Tainted: G W
[ 1094.009179] ---------------------------------------------
[ 1094.009180] vim/12891 is trying to acquire lock:
[ 1094.009182] (&ei->log_mutex){+.+...}, at: [<000003ff817e83c6>] btrfs_log_inode+0x126/0x1010 [btrfs]
[ 1094.009256]
but task is already holding lock:
[ 1094.009258] (&ei->log_mutex){+.+...}, at: [<000003ff817e83c6>] btrfs_log_inode+0x126/0x1010 [btrfs]
[ 1094.009276]
other info that might help us debug this:
[ 1094.009278] Possible unsafe locking scenario:

[ 1094.009280] CPU0
[ 1094.009281] ----
[ 1094.009282] lock(&ei->log_mutex);
[ 1094.009284] lock(&ei->log_mutex);
[ 1094.009286]
*** DEADLOCK ***

[ 1094.009288] May be due to missing lock nesting notation

[ 1094.009290] 3 locks held by vim/12891:
[ 1094.009291] #0: (&sb->s_type->i_mutex_key#15){+.+.+.}, at: [<000003ff817afbd6>] btrfs_sync_file+0x1de/0x5e8 [btrfs]
[ 1094.009311] #1: (sb_internal#2){.+.+..}, at: [<000000000035e0ba>] __sb_start_write+0x122/0x138
[ 1094.009320] #2: (&ei->log_mutex){+.+...}, at: [<000003ff817e83c6>] btrfs_log_inode+0x126/0x1010 [btrfs]
[ 1094.009370]
stack backtrace:
[ 1094.009375] CPU: 14 PID: 12891 Comm: vim Tainted: G W 4.8.0-rc3 #126
[ 1094.009377] Hardware name: IBM 2964 NC9 704 (LPAR)
[ 1094.009380] 000000f061367608 000000f061367698 0000000000000002 0000000000000000
000000f061367738 000000f0613676b0 000000f0613676b0 00000000001133ec
0000000000000000 0000000000000000 000000f70000000a 000000f70000000a
000000f0613676f8 000000f061367698 0000000000000000 0000000000000000
0400000001d821c8 00000000001133ec 000000f061367698 000000f0613676e8
[ 1094.009396] Call Trace:
[ 1094.009401] ([<0000000000113334>] show_trace+0xec/0xf0)
[ 1094.009403] ([<000000000011339a>] show_stack+0x62/0xe8)
[ 1094.009406] ([<000000000055211c>] dump_stack+0x9c/0xe0)
[ 1094.009411] ([<00000000001d9930>] validate_chain.isra.22+0xc00/0xd70)
[ 1094.009413] ([<00000000001dad9c>] __lock_acquire+0x39c/0x7d8)
[ 1094.009414] ([<00000000001db8d0>] lock_acquire+0x108/0x320)
[ 1094.009420] ([<00000000008845c6>] mutex_lock_nested+0x86/0x3f8)
[ 1094.009440] ([<000003ff817e83c6>] btrfs_log_inode+0x126/0x1010 [btrfs])
[ 1094.009457] ([<000003ff817e8fb2>] btrfs_log_inode+0xd12/0x1010 [btrfs])
[ 1094.009474] ([<000003ff817e95b4>] btrfs_log_inode_parent+0x244/0x980 [btrfs])
[ 1094.009490] ([<000003ff817eafea>] btrfs_log_dentry_safe+0x7a/0xa0 [btrfs])
[ 1094.009506] ([<000003ff817afe1a>] btrfs_sync_file+0x422/0x5e8 [btrfs])
[ 1094.009512] ([<000000000039e64e>] do_fsync+0x5e/0x90)
[ 1094.009514] ([<000000000039e9e2>] SyS_fsync+0x32/0x40)
[ 1094.009517] ([<000000000088a336>] system_call+0xd6/0x270)
[ 1094.009518] INFO: lockdep is turned off.