possible deadlock in hfs_find_init

Status: upstream: reported C repro on 2023/01/26 19:14
Subsystems: hfs
[Documentation on labels]
First crash: 511d, last: 478d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in hfs_find_init origin:upstream C error 34 3d01h 456d 0/3 upstream: reported C repro on 2023/03/22 23:14
linux-4.19 possible deadlock in hfs_find_init hfs C error 7 473d 538d 0/1 upstream: reported C repro on 2022/12/30 06:08
upstream possible deadlock in hfs_find_init (2) hfs C error 757 4h15m 541d 0/27 upstream: reported C repro on 2022/12/27 00:59
linux-6.1 possible deadlock in hfs_find_init origin:upstream C 56 4d11h 458d 0/3 upstream: reported C repro on 2023/03/20 17:38
upstream possible deadlock in hfs_find_init hfs C done error 1 1260d 2250d 20/27 fixed on 2021/11/10 00:50
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/02/28 06:41 26m bisect fix linux-4.14.y job log (0) log

Sample crash report:
IPVS: ftp: loaded support on port[0] = 21
WARNING: possible recursive locking detected
4.14.304-syzkaller #0 Not tainted
kworker/u4:3/696 is trying to acquire lock:
 (&tree->tree_lock/1){+.+.}, at: [<ffffffff81d4c4cf>] hfs_find_init+0x16f/0x220 fs/hfs/bfind.c:33

but task is already holding lock:
 (&tree->tree_lock/1){+.+.}, at: [<ffffffff81d4c4cf>] hfs_find_init+0x16f/0x220 fs/hfs/bfind.c:33

other info that might help us debug this:
 Possible unsafe locking scenario:


 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by kworker/u4:3/696:
 #0:  ("writeback"){+.+.}, at: [<ffffffff81365fe0>] process_one_work+0x6b0/0x14a0 kernel/workqueue.c:2088
 #1:  ((&(&wb->dwork)->work)){+.+.}, at: [<ffffffff81366016>] process_one_work+0x6e6/0x14a0 kernel/workqueue.c:2092
 #2:  (&tree->tree_lock/1){+.+.}, at: [<ffffffff81d4c4cf>] hfs_find_init+0x16f/0x220 fs/hfs/bfind.c:33
 #3:  (&HFS_I(tree->inode)->extents_lock){+.+.}, at: [<ffffffff81d5b305>] hfs_extend_file+0x85/0xa40 fs/hfs/extent.c:397

stack backtrace:
CPU: 0 PID: 696 Comm: kworker/u4:3 Not tainted 4.14.304-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Workqueue: writeback wb_workfn (flush-7:0)
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_deadlock_bug kernel/locking/lockdep.c:1800 [inline]
 check_deadlock kernel/locking/lockdep.c:1847 [inline]
 validate_chain kernel/locking/lockdep.c:2448 [inline]
 __lock_acquire.cold+0x180/0x97c kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 hfs_find_init+0x16f/0x220 fs/hfs/bfind.c:33
 hfs_ext_read_extent+0x15e/0x930 fs/hfs/extent.c:200
 hfs_extend_file+0x439/0xa40 fs/hfs/extent.c:401
 hfs_bmap_reserve+0x229/0x370 fs/hfs/btree.c:231
 __hfs_ext_write_extent+0x393/0x4d0 fs/hfs/extent.c:121
 hfs_ext_write_extent fs/hfs/extent.c:144 [inline]
 hfs_ext_write_extent+0x155/0x190 fs/hfs/extent.c:135
 hfs_write_inode+0x7e/0x8f0 fs/hfs/inode.c:426
 write_inode fs/fs-writeback.c:1241 [inline]
 __writeback_single_inode+0x6a4/0x1010 fs/fs-writeback.c:1439
 writeback_sb_inodes+0x48b/0xd30 fs/fs-writeback.c:1645
 wb_writeback+0x243/0xb80 fs/fs-writeback.c:1820
 wb_do_writeback fs/fs-writeback.c:1952 [inline]
 wb_workfn+0x2bd/0xf50 fs/fs-writeback.c:1988
 process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/26 19:13 linux-4.14.y 3949d1610004 9dfcf09c .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 possible deadlock in hfs_find_init
* Struck through repros no longer work on HEAD.