loop0: detected capacity change from 0 to 64 ====================================================== WARNING: possible circular locking dependency detected 6.7.0-rc6-syzkaller-00044-g1a44b0073b92 #0 Not tainted ------------------------------------------------------ syz-executor260/5245 is trying to acquire lock: ffff88807dd9c0b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x17f/0x220 fs/hfs/bfind.c:33 but task is already holding lock: ffff88802334cef8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xa2/0xb10 fs/hfs/extent.c:397 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x175/0x9d0 kernel/locking/mutex.c:747 hfs_extend_file+0xa2/0xb10 fs/hfs/extent.c:397 hfs_bmap_reserve+0x29c/0x370 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x3cb/0x520 fs/hfs/extent.c:121 hfs_ext_write_extent+0x1b3/0x1f0 fs/hfs/extent.c:144 hfs_write_inode+0xc4/0x9f0 fs/hfs/inode.c:431 write_inode fs/fs-writeback.c:1473 [inline] __writeback_single_inode+0xa91/0xe90 fs/fs-writeback.c:1690 writeback_sb_inodes+0x599/0x1080 fs/fs-writeback.c:1916 wb_writeback+0x2a5/0xaa0 fs/fs-writeback.c:2092 wb_do_writeback fs/fs-writeback.c:2239 [inline] wb_workfn+0x29c/0xfe0 fs/fs-writeback.c:2279 process_one_work+0x886/0x15d0 kernel/workqueue.c:2627 process_scheduled_works kernel/workqueue.c:2700 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2781 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x175/0x9d0 kernel/locking/mutex.c:747 hfs_find_init+0x17f/0x220 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x19c/0x9d0 fs/hfs/extent.c:200 hfs_extend_file+0x4e0/0xb10 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29c/0x370 fs/hfs/btree.c:234 hfs_cat_create+0x227/0x810 fs/hfs/catalog.c:104 hfs_create+0x67/0xe0 fs/hfs/dir.c:202 lookup_open.isra.0+0x1095/0x13b0 fs/namei.c:3477 open_last_lookups fs/namei.c:3546 [inline] path_openat+0x922/0x2c50 fs/namei.c:3776 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); *** DEADLOCK *** 4 locks held by syz-executor260/5245: #0: ffff88807dd9a418 (sb_writers#9){.+.+}-{0:0}, at: open_last_lookups fs/namei.c:3535 [inline] #0: ffff88807dd9a418 (sb_writers#9){.+.+}-{0:0}, at: path_openat+0x19f6/0x2c50 fs/namei.c:3776 #1: ffff88802334d728 (&type->i_mutex_dir_key#6){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:802 [inline] #1: ffff88802334d728 (&type->i_mutex_dir_key#6){+.+.}-{3:3}, at: open_last_lookups fs/namei.c:3543 [inline] #1: ffff88802334d728 (&type->i_mutex_dir_key#6){+.+.}-{3:3}, at: path_openat+0x8bd/0x2c50 fs/namei.c:3776 #2: ffff88802b1d80b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfs_find_init+0x1b6/0x220 fs/hfs/bfind.c:30 #3: ffff88802334cef8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xa2/0xb10 fs/hfs/extent.c:397 stack backtrace: CPU: 0 PID: 5245 Comm: syz-executor260 Not tainted 6.7.0-rc6-syzkaller-00044-g1a44b0073b92 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x317/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2433/0x3b20 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x175/0x9d0 kernel/locking/mutex.c:747 hfs_find_init+0x17f/0x220 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x19c/0x9d0 fs/hfs/extent.c:200 hfs_extend_file+0x4e0/0xb10 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29c/0x370 fs/hfs/btree.c:234 hfs_cat_create+0x227/0x810 fs/hfs/catalog.c:104 hfs_create+0x67/0xe0 fs/hfs/dir.c:202 lookup_open.isra.0+0x1095/0x13b0 fs/namei.c:3477 open_last_lookups fs/namei.c:3546 [inline] path_openat+0x922/0x2c50 fs/namei.c:3776 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f4b2d229759 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4b2d1e5168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f4b2d2b26c8 RCX: 00007f4b2d229759 RDX: 000000000000275a RSI: 0000000020000000 RDI: 00000000ffffff9c RBP: 00007f4b2d2b26c0 R08: 00007f4b2d2b26c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4b2d2b26cc R13: 0000000000000006 R14: 00007ffd328e4bf0 R15: 00007ffd328e4cd8 hfs: request for non-existent node 16777216 in B*Tree hfs: request for non-existent node 16777216 in B*Tree hfs: inconsistency in B*Tree (5,0,1,0,1)