====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc7-syzkaller-00012-g3022e9d00ebe #0 Not tainted ------------------------------------------------------ kworker/u8:9/3516 is trying to acquire lock: ffff8880771f0660 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_try_remove_refcount_tree+0xb6/0x330 fs/ocfs2/refcounttree.c:932 but task is already holding lock: ffff8880771f06f8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_try_remove_refcount_tree+0xa5/0x330 fs/ocfs2/refcounttree.c:931 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&oi->ip_xattr_sem){++++}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524 ocfs2_init_acl+0x397/0x930 fs/ocfs2/acl.c:366 ocfs2_mknod+0x1c05/0x2b40 fs/ocfs2/namei.c:408 ocfs2_create+0x1ab/0x480 fs/ocfs2/namei.c:672 lookup_open fs/namei.c:3595 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x1c03/0x3590 fs/namei.c:3930 do_filp_open+0x235/0x490 fs/namei.c:3960 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_open fs/open.c:1438 [inline] __se_sys_open fs/open.c:1434 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1434 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 -> #3 (jbd2_handle){++++}-{0:0}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 start_this_handle+0x1eb4/0x2110 fs/jbd2/transaction.c:448 jbd2__journal_start+0x2da/0x5d0 fs/jbd2/transaction.c:505 jbd2_journal_start+0x29/0x40 fs/jbd2/transaction.c:544 ocfs2_start_trans+0x3c9/0x700 fs/ocfs2/journal.c:352 ocfs2_block_group_alloc fs/ocfs2/suballoc.c:685 [inline] ocfs2_reserve_suballoc_bits+0x9f6/0x4eb0 fs/ocfs2/suballoc.c:832 ocfs2_reserve_new_metadata_blocks+0x41c/0x9c0 fs/ocfs2/suballoc.c:982 ocfs2_mknod+0x143a/0x2b40 fs/ocfs2/namei.c:345 ocfs2_create+0x1ab/0x480 fs/ocfs2/namei.c:672 lookup_open fs/namei.c:3595 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x1c03/0x3590 fs/namei.c:3930 do_filp_open+0x235/0x490 fs/namei.c:3960 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_open fs/open.c:1438 [inline] __se_sys_open fs/open.c:1434 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1434 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 -> #2 (&journal->j_trans_barrier){.+.+}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524 ocfs2_start_trans+0x3be/0x700 fs/ocfs2/journal.c:350 ocfs2_block_group_alloc fs/ocfs2/suballoc.c:685 [inline] ocfs2_reserve_suballoc_bits+0x9f6/0x4eb0 fs/ocfs2/suballoc.c:832 ocfs2_reserve_new_metadata_blocks+0x41c/0x9c0 fs/ocfs2/suballoc.c:982 ocfs2_mknod+0x143a/0x2b40 fs/ocfs2/namei.c:345 ocfs2_create+0x1ab/0x480 fs/ocfs2/namei.c:672 lookup_open fs/namei.c:3595 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x1c03/0x3590 fs/namei.c:3930 do_filp_open+0x235/0x490 fs/namei.c:3960 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_open fs/open.c:1438 [inline] __se_sys_open fs/open.c:1434 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1434 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 -> #1 (sb_internal#2){.+.+}-{0:0}: reacquire_held_locks+0x3eb/0x690 kernel/locking/lockdep.c:5350 __lock_release kernel/locking/lockdep.c:5539 [inline] lock_release+0x396/0xa30 kernel/locking/lockdep.c:5846 up_write+0x79/0x590 kernel/locking/rwsem.c:1629 inode_unlock include/linux/fs.h:820 [inline] ocfs2_free_ac_resource fs/ocfs2/suballoc.c:130 [inline] ocfs2_free_alloc_context+0x95/0x1a0 fs/ocfs2/suballoc.c:144 ocfs2_write_begin_nolock+0x4d30/0x4ec0 fs/ocfs2/aops.c:1823 ocfs2_dio_wr_get_block+0xc3b/0x18d0 fs/ocfs2/aops.c:2237 get_more_blocks fs/direct-io.c:648 [inline] do_direct_IO fs/direct-io.c:936 [inline] __blockdev_direct_IO+0x1c8e/0x4890 fs/direct-io.c:1243 ocfs2_direct_IO+0x255/0x2c0 fs/ocfs2/aops.c:2464 generic_file_direct_write+0x17a/0x390 mm/filemap.c:3977 __generic_file_write_iter+0x126/0x230 mm/filemap.c:4141 ocfs2_file_write_iter+0x17b1/0x1f50 fs/ocfs2/file.c:2467 do_iter_readv_writev+0x600/0x880 vfs_writev+0x376/0xba0 fs/read_write.c:1064 do_pwritev fs/read_write.c:1165 [inline] __do_sys_pwritev2 fs/read_write.c:1224 [inline] __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1215 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 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_write+0x99/0x220 kernel/locking/rwsem.c:1577 ocfs2_try_remove_refcount_tree+0xb6/0x330 fs/ocfs2/refcounttree.c:932 ocfs2_truncate_file+0xe08/0x1560 fs/ocfs2/file.c:521 ocfs2_recover_orphans fs/ocfs2/journal.c:2306 [inline] ocfs2_complete_recovery+0x1276/0x25c0 fs/ocfs2/journal.c:1351 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 other info that might help us debug this: Chain exists of: &ocfs2_file_ip_alloc_sem_key --> jbd2_handle --> &oi->ip_xattr_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&oi->ip_xattr_sem); lock(jbd2_handle); lock(&oi->ip_xattr_sem); lock(&ocfs2_file_ip_alloc_sem_key); *** DEADLOCK *** 4 locks held by kworker/u8:9/3516: #0: ffff888031993948 ((wq_completion)ocfs2_wq){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline] #0: ffff888031993948 ((wq_completion)ocfs2_wq){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1850 kernel/workqueue.c:3310 #1: ffffc9000cad7d00 ((work_completion)(&journal->j_recovery_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline] #1: ffffc9000cad7d00 ((work_completion)(&journal->j_recovery_work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1850 kernel/workqueue.c:3310 #2: ffff8880771f09c0 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #2: ffff8880771f09c0 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: ocfs2_recover_orphans fs/ocfs2/journal.c:2287 [inline] #2: ffff8880771f09c0 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: ocfs2_complete_recovery+0xfb8/0x25c0 fs/ocfs2/journal.c:1351 #3: ffff8880771f06f8 (&oi->ip_xattr_sem){++++}-{3:3}, at: ocfs2_try_remove_refcount_tree+0xa5/0x330 fs/ocfs2/refcounttree.c:931 stack backtrace: CPU: 1 UID: 0 PID: 3516 Comm: kworker/u8:9 Not tainted 6.12.0-rc7-syzkaller-00012-g3022e9d00ebe #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Workqueue: ocfs2_wq ocfs2_complete_recovery Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 down_write+0x99/0x220 kernel/locking/rwsem.c:1577 ocfs2_try_remove_refcount_tree+0xb6/0x330 fs/ocfs2/refcounttree.c:932 ocfs2_truncate_file+0xe08/0x1560 fs/ocfs2/file.c:521 ocfs2_recover_orphans fs/ocfs2/journal.c:2306 [inline] ocfs2_complete_recovery+0x1276/0x25c0 fs/ocfs2/journal.c:1351 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244