======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kworker/u8:6/266 is trying to acquire lock:
ffff888090019478 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xa6/0xcf0 fs/hfs/extent.c:397
but task is already holding lock:
ffff8880262780b0 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x273/0x330 fs/hfs/bfind.c:36
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&tree->tree_lock/1){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
hfs_find_init+0x273/0x330 fs/hfs/bfind.c:36
hfs_ext_read_extent+0x19d/0x9d0 fs/hfs/extent.c:200
hfs_get_block+0x576/0x830 fs/hfs/extent.c:366
block_read_full_folio+0x36c/0x8e0 fs/buffer.c:2417
filemap_read_folio+0xfc/0x3b0 mm/filemap.c:2501
do_read_cache_folio+0x2d7/0x6b0 mm/filemap.c:4101
do_read_cache_page mm/filemap.c:4167 [inline]
read_cache_page+0x5b/0x1b0 mm/filemap.c:4176
read_mapping_page include/linux/pagemap.h:1022 [inline]
__hfs_bnode_create+0x718/0x9a0 fs/hfs/bnode.c:388
hfs_bnode_find+0x2d5/0xd30 fs/hfs/bnode.c:433
hfs_brec_find+0x39d/0x620 fs/hfs/bfind.c:135
hfs_brec_read+0x26/0x120 fs/hfs/bfind.c:174
hfs_cat_find_brec+0xdc/0x2a0 fs/hfs/catalog.c:194
hfs_fill_super+0x58d/0x7e0 fs/hfs/super.c:357
get_tree_bdev_flags+0x38c/0x620 fs/super.c:1694
vfs_get_tree+0x92/0x320 fs/super.c:1754
fc_mount fs/namespace.c:1193 [inline]
do_new_mount_fc fs/namespace.c:3763 [inline]
do_new_mount fs/namespace.c:3839 [inline]
path_mount+0x7d0/0x23d0 fs/namespace.c:4159
do_mount fs/namespace.c:4172 [inline]
__do_sys_mount fs/namespace.c:4361 [inline]
__se_sys_mount fs/namespace.c:4338 [inline]
__x64_sys_mount+0x293/0x310 fs/namespace.c:4338
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x14b8/0x2630 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x1cf/0x380 kernel/locking/lockdep.c:5825
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
hfs_extend_file+0xa6/0xcf0 fs/hfs/extent.c:397
hfs_bmap_reserve+0x2ab/0x3a0 fs/hfs/btree.c:269
__hfs_ext_write_extent+0x3c4/0x510 fs/hfs/extent.c:121
hfs_ext_write_extent+0x1b7/0x200 fs/hfs/extent.c:144
hfs_write_inode+0xce/0xab0 fs/hfs/inode.c:459
write_inode fs/fs-writeback.c:1582 [inline]
__writeback_single_inode+0xd00/0x13c0 fs/fs-writeback.c:1813
writeback_sb_inodes+0x766/0x1c70 fs/fs-writeback.c:2042
wb_writeback+0x1c0/0xbe0 fs/fs-writeback.c:2227
wb_do_writeback fs/fs-writeback.c:2374 [inline]
wb_workfn+0x142/0xc00 fs/fs-writeback.c:2414
process_one_work+0xa23/0x19a0 kernel/workqueue.c:3276
process_scheduled_works kernel/workqueue.c:3359 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3440
kthread+0x370/0x450 kernel/kthread.c:436
ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&tree->tree_lock/1);
lock(&HFS_I(tree->inode)->extents_lock);
lock(&tree->tree_lock/1);
lock(&HFS_I(tree->inode)->extents_lock);
*** DEADLOCK ***
3 locks held by kworker/u8:6/266:
#0: ffff888020e8f148 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x1310/0x19a0 kernel/workqueue.c:3251
#1: ffffc900030efd08 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x988/0x19a0 kernel/workqueue.c:3252
#2: ffff8880262780b0 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x273/0x330 fs/hfs/bfind.c:36
stack backtrace:
CPU: 0 UID: 0 PID: 266 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/27/2026
Workqueue: writeback wb_workfn (flush-7:5)
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_circular_bug.cold+0x178/0x1c7 kernel/locking/lockdep.c:2043
check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x14b8/0x2630 kernel/locking/lockdep.c:5237
lock_acquire kernel/locking/lockdep.c:5868 [inline]
lock_acquire+0x1cf/0x380 kernel/locking/lockdep.c:5825
__mutex_lock_common kernel/locking/mutex.c:614 [inline]
__mutex_lock+0x1a2/0x1b90 kernel/locking/mutex.c:776
hfs_extend_file+0xa6/0xcf0 fs/hfs/extent.c:397
hfs_bmap_reserve+0x2ab/0x3a0 fs/hfs/btree.c:269
__hfs_ext_write_extent+0x3c4/0x510 fs/hfs/extent.c:121
hfs_ext_write_extent+0x1b7/0x200 fs/hfs/extent.c:144
hfs_write_inode+0xce/0xab0 fs/hfs/inode.c:459
write_inode fs/fs-writeback.c:1582 [inline]
__writeback_single_inode+0xd00/0x13c0 fs/fs-writeback.c:1813
writeback_sb_inodes+0x766/0x1c70 fs/fs-writeback.c:2042
wb_writeback+0x1c0/0xbe0 fs/fs-writeback.c:2227
wb_do_writeback fs/fs-writeback.c:2374 [inline]
wb_workfn+0x142/0xc00 fs/fs-writeback.c:2414
process_one_work+0xa23/0x19a0 kernel/workqueue.c:3276
process_scheduled_works kernel/workqueue.c:3359 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3440
kthread+0x370/0x450 kernel/kthread.c:436
ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
hfs: new node 0 already hashed?
------------[ cut here ]------------
1
WARNING: fs/hfs/bnode.c:520 at hfs_bnode_create.cold+0x41/0x49 fs/hfs/bnode.c:520, CPU#0: kworker/u8:6/266
Modules linked in:
CPU: 0 UID: 0 PID: 266 Comm: kworker/u8:6 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/27/2026
Workqueue: writeback wb_workfn (flush-7:5)
RIP: 0010:hfs_bnode_create.cold+0x41/0x49 fs/hfs/bnode.c:520
Code: bd 18 6a 0a e9 3f 53 d0 01 e8 43 32 e1 00 4c 89 f7 e8 ab 18 6a 0a e8 36 32 e1 00 89 ee 48 c7 c7 80 77 d1 8b e8 08 e4 fa ff 90 <0f> 0b 90 e9 41 56 d0 01 e8 1a 32 e1 00 e8 55 ed 4d 00 e9 9d 58 d0
RSP: 0018:ffffc900030ef030 EFLAGS: 00010282
RAX: 000000000000001f RBX: ffff88806201ae00 RCX: 0000000000000000
RDX: 000000000000001f RSI: ffffffff81e784e9 RDI: fffff5200061ddf7
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 77656e203a736668 R12: dffffc0000000000
R13: ffff888026278000 R14: ffff8880262780e0 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff888124343000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007effe37e92f8 CR3: 000000005f5ff000 CR4: 0000000000350ef0
Call Trace:
hfs_bmap_alloc+0x5a7/0x6b0 fs/hfs/btree.c:326
hfs_btree_inc_height.isra.0+0xff/0x820 fs/hfs/brec.c:490
hfs_brec_insert+0x8ba/0xc20 fs/hfs/brec.c:148
__hfs_ext_write_extent+0x3ef/0x510 fs/hfs/extent.c:124
hfs_ext_write_extent+0x1b7/0x200 fs/hfs/extent.c:144
hfs_write_inode+0xce/0xab0 fs/hfs/inode.c:459
write_inode fs/fs-writeback.c:1582 [inline]
__writeback_single_inode+0xd00/0x13c0 fs/fs-writeback.c:1813
writeback_sb_inodes+0x766/0x1c70 fs/fs-writeback.c:2042
wb_writeback+0x1c0/0xbe0 fs/fs-writeback.c:2227
wb_do_writeback fs/fs-writeback.c:2374 [inline]
wb_workfn+0x142/0xc00 fs/fs-writeback.c:2414
process_one_work+0xa23/0x19a0 kernel/workqueue.c:3276
process_scheduled_works kernel/workqueue.c:3359 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3440
kthread+0x370/0x450 kernel/kthread.c:436
ret_from_fork+0x754/0xd80 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245