hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed ====================================================== WARNING: possible circular locking dependency detected 6.11.0-syzkaller-05319-g4a39ac5b7d62 #0 Not tainted ------------------------------------------------------ syz-executor/7037 is trying to acquire lock: ffff88802274b8f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xbb/0x4e0 fs/hfsplus/bitmap.c:182 but task is already holding lock: ffff8880513f5f88 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x30a/0xc70 fs/hfsplus/extents.c:577 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_get_block+0x383/0x14f0 fs/hfsplus/extents.c:260 block_read_full_folio+0x418/0xcd0 fs/buffer.c:2401 filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355 do_read_cache_folio+0x134/0x820 mm/filemap.c:3796 do_read_cache_page+0x30/0x200 mm/filemap.c:3862 read_mapping_page include/linux/pagemap.h:909 [inline] hfsplus_block_allocate+0xee/0x8c0 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0xade/0x1b70 fs/hfsplus/extents.c:469 hfsplus_get_block+0x406/0x14f0 fs/hfsplus/extents.c:245 __block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121 block_write_begin fs/buffer.c:2231 [inline] cont_write_begin+0x6e2/0x9d0 fs/buffer.c:2582 hfsplus_write_begin+0x68/0xb0 fs/hfsplus/inode.c:46 generic_perform_write+0x37e/0x730 mm/filemap.c:4025 generic_file_write_iter+0xae/0x310 mm/filemap.c:4152 new_sync_write fs/read_write.c:590 [inline] vfs_write+0xa6d/0xc90 fs/read_write.c:683 ksys_write+0x1a0/0x2c0 fs/read_write.c:736 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&sbi->alloc_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3158 [inline] check_prevs_add kernel/locking/lockdep.c:3277 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5199 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_block_free+0xbb/0x4e0 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x17a/0xae0 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x86c/0xc70 fs/hfsplus/extents.c:592 hfsplus_delete_inode+0x174/0x220 hfsplus_unlink+0x512/0x790 fs/hfsplus/dir.c:405 vfs_unlink+0x365/0x650 fs/namei.c:4469 do_unlinkat+0x4ae/0x830 fs/namei.c:4533 __do_sys_unlink fs/namei.c:4581 [inline] __se_sys_unlink fs/namei.c:4579 [inline] __x64_sys_unlink+0x47/0x50 fs/namei.c:4579 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); *** DEADLOCK *** 5 locks held by syz-executor/7037: #0: ffff888011e5e420 (sb_writers#28){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff8880513f53f8 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:850 [inline] #1: ffff8880513f53f8 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: do_unlinkat+0x26a/0x830 fs/namei.c:4520 #2: ffff8880513f6178 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #2: ffff8880513f6178 (&sb->s_type->i_mutex_key#37){+.+.}-{3:3}, at: vfs_unlink+0xe4/0x650 fs/namei.c:4458 #3: ffff88802274b998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x161/0x790 fs/hfsplus/dir.c:370 #4: ffff8880513f5f88 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x30a/0xc70 fs/hfsplus/extents.c:577 stack backtrace: CPU: 0 UID: 0 PID: 7037 Comm: syz-executor Not tainted 6.11.0-syzkaller-05319-g4a39ac5b7d62 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2203 check_prev_add kernel/locking/lockdep.c:3158 [inline] check_prevs_add kernel/locking/lockdep.c:3277 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3901 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5199 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5822 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_block_free+0xbb/0x4e0 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x17a/0xae0 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x86c/0xc70 fs/hfsplus/extents.c:592 hfsplus_delete_inode+0x174/0x220 hfsplus_unlink+0x512/0x790 fs/hfsplus/dir.c:405 vfs_unlink+0x365/0x650 fs/namei.c:4469 do_unlinkat+0x4ae/0x830 fs/namei.c:4533 __do_sys_unlink fs/namei.c:4581 [inline] __se_sys_unlink fs/namei.c:4579 [inline] __x64_sys_unlink+0x47/0x50 fs/namei.c:4579 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f43a2b7d4a7 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff289768c8 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f43a2b7d4a7 RDX: 00007fff289768f0 RSI: 00007fff28976980 RDI: 00007fff28976980 RBP: 00007fff28976980 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007fff28977a70 R13: 00007f43a2bf0a14 R14: 0000000000033949 R15: 00007fff28979c20 hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr searching failed hfsplus: inconsistency in B*Tree (128,1,255,1,0) hfsplus: xattr search failed syz-executor: attempt to access beyond end of device loop3: rw=2049, sector=45096, nr_sectors = 24 limit=40427 F2FS-fs (loop3): Stopped filesystem due to reason: 3 F2FS-fs (loop3): Stopped filesystem due to reason: 3 F2FS-fs (loop3): Stopped filesystem due to reason: 3