loop0: detected capacity change from 32768 to 0 ocfs2: Mounting device (7,0) on (node local, slot 0) with writeback data mode. ====================================================== WARNING: possible circular locking dependency detected 5.11.0-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.18/4190 is trying to acquire lock: ffff888116365488 (&osb->system_file_mutex){+.+.}-{3:3}, at: ocfs2_get_system_file_inode+0x1b6/0x350 fs/ocfs2/sysfile.c:103 but task is already holding lock: ffff88810de38660 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_write_begin+0xde/0x1c0 fs/ocfs2/aops.c:1907 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}: down_read+0x23/0xc0 kernel/locking/rwsem.c:1353 ocfs2_read_virt_blocks+0x9b/0x390 fs/ocfs2/extent_map.c:978 ocfs2_read_dir_block+0x41/0x1b0 fs/ocfs2/dir.c:504 ocfs2_find_entry_el fs/ocfs2/dir.c:711 [inline] ocfs2_find_entry+0x1bd/0x6a0 fs/ocfs2/dir.c:1076 ocfs2_find_files_on_disk+0x40/0x110 fs/ocfs2/dir.c:1975 ocfs2_lookup_ino_from_name+0x3a/0x70 fs/ocfs2/dir.c:1997 _ocfs2_get_system_file_inode fs/ocfs2/sysfile.c:138 [inline] ocfs2_get_system_file_inode+0xdc/0x350 fs/ocfs2/sysfile.c:114 ocfs2_init_global_system_inodes fs/ocfs2/super.c:462 [inline] ocfs2_initialize_super.isra.0+0x8d2/0x11b0 fs/ocfs2/super.c:2283 ocfs2_fill_super+0x37f/0x19e0 fs/ocfs2/super.c:1007 mount_bdev+0x185/0x1b0 fs/super.c:1366 legacy_get_tree+0x2b/0x50 fs/fs_context.c:592 vfs_get_tree+0x1e/0x80 fs/super.c:1496 do_new_mount fs/namespace.c:2881 [inline] path_mount+0x2b1/0xc00 fs/namespace.c:3211 do_mount fs/namespace.c:3224 [inline] __do_sys_mount fs/namespace.c:3432 [inline] __se_sys_mount fs/namespace.c:3409 [inline] __x64_sys_mount+0xfe/0x140 fs/namespace.c:3409 do_syscall_64+0x34/0x50 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #0 (&osb->system_file_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x114c/0x1b30 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0xc9/0x3f0 kernel/locking/lockdep.c:5407 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x6c/0x660 kernel/locking/mutex.c:1103 ocfs2_get_system_file_inode+0x1b6/0x350 fs/ocfs2/sysfile.c:103 ocfs2_reserve_local_alloc_bits+0x40/0x420 fs/ocfs2/localalloc.c:628 ocfs2_reserve_clusters_with_limit+0x198/0x470 fs/ocfs2/suballoc.c:1164 ocfs2_reserve_clusters fs/ocfs2/suballoc.c:1225 [inline] ocfs2_lock_allocators+0xd0/0x230 fs/ocfs2/suballoc.c:2670 ocfs2_write_begin_nolock+0x39c/0x1fc0 fs/ocfs2/aops.c:1745 ocfs2_write_begin+0xfa/0x1c0 fs/ocfs2/aops.c:1909 generic_perform_write+0xba/0x1b0 mm/filemap.c:3412 __generic_file_write_iter+0x143/0x1c0 mm/filemap.c:3541 ocfs2_file_write_iter+0x541/0xd80 fs/ocfs2/file.c:2377 call_write_iter include/linux/fs.h:1901 [inline] new_sync_write+0x11a/0x1b0 fs/read_write.c:518 vfs_write+0x263/0x360 fs/read_write.c:605 ksys_pwrite64 fs/read_write.c:712 [inline] __do_sys_pwrite64 fs/read_write.c:722 [inline] __se_sys_pwrite64 fs/read_write.c:719 [inline] __x64_sys_pwrite64+0x87/0xc0 fs/read_write.c:719 do_syscall_64+0x34/0x50 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ocfs2_file_ip_alloc_sem_key); lock(&osb->system_file_mutex); lock(&ocfs2_file_ip_alloc_sem_key); lock(&osb->system_file_mutex); *** DEADLOCK *** 3 locks held by syz.0.18/4190: #0: ffff88810af08448 (sb_writers#12){.+.+}-{0:0}, at: ksys_pwrite64 fs/read_write.c:712 [inline] #0: ffff88810af08448 (sb_writers#12){.+.+}-{0:0}, at: __do_sys_pwrite64 fs/read_write.c:722 [inline] #0: ffff88810af08448 (sb_writers#12){.+.+}-{0:0}, at: __se_sys_pwrite64 fs/read_write.c:719 [inline] #0: ffff88810af08448 (sb_writers#12){.+.+}-{0:0}, at: __x64_sys_pwrite64+0x87/0xc0 fs/read_write.c:719 #1: ffff88810de389c8 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline] #1: ffff88810de389c8 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: ocfs2_file_write_iter+0x193/0xd80 fs/ocfs2/file.c:2309 #2: ffff88810de38660 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}, at: ocfs2_write_begin+0xde/0x1c0 fs/ocfs2/aops.c:1907 stack backtrace: CPU: 1 PID: 4190 Comm: syz.0.18 Not tainted 5.11.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x77/0x97 lib/dump_stack.c:120 check_noncircular+0xcc/0xe0 kernel/locking/lockdep.c:2117 check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add kernel/locking/lockdep.c:2993 [inline] validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x114c/0x1b30 kernel/locking/lockdep.c:4832 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0xc9/0x3f0 kernel/locking/lockdep.c:5407 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x6c/0x660 kernel/locking/mutex.c:1103 ocfs2_get_system_file_inode+0x1b6/0x350 fs/ocfs2/sysfile.c:103 ocfs2_reserve_local_alloc_bits+0x40/0x420 fs/ocfs2/localalloc.c:628 ocfs2_reserve_clusters_with_limit+0x198/0x470 fs/ocfs2/suballoc.c:1164 ocfs2_reserve_clusters fs/ocfs2/suballoc.c:1225 [inline] ocfs2_lock_allocators+0xd0/0x230 fs/ocfs2/suballoc.c:2670 ocfs2_write_begin_nolock+0x39c/0x1fc0 fs/ocfs2/aops.c:1745 ocfs2_write_begin+0xfa/0x1c0 fs/ocfs2/aops.c:1909 generic_perform_write+0xba/0x1b0 mm/filemap.c:3412 __generic_file_write_iter+0x143/0x1c0 mm/filemap.c:3541 ocfs2_file_write_iter+0x541/0xd80 fs/ocfs2/file.c:2377 call_write_iter include/linux/fs.h:1901 [inline] new_sync_write+0x11a/0x1b0 fs/read_write.c:518 vfs_write+0x263/0x360 fs/read_write.c:605 ksys_pwrite64 fs/read_write.c:712 [inline] __do_sys_pwrite64 fs/read_write.c:722 [inline] __se_sys_pwrite64 fs/read_write.c:719 [inline] __x64_sys_pwrite64+0x87/0xc0 fs/read_write.c:719 do_syscall_64+0x34/0x50 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f8dec559ef9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8debfdb038 EFLAGS: 00000246 ORIG_RAX: 0000000000000012 RAX: ffffffffffffffda RBX: 00007f8dec711f80 RCX: 00007f8dec559ef9 RDX: 000000000000fdef RSI: 0000000020000140 RDI: 0000000000000004 RBP: 00007f8dec5ccb76 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000fecc R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f8dec711f80 R15: 00007ffccf49ccc8