loop0: detected capacity change from 0 to 32768 ======================================================= WARNING: The mand mount option has been deprecated and and is ignored by this kernel. Remove the mand option from the mount to silence this warning. ======================================================= JBD2: Ignoring recovery information on journal ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode. ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.0/5321 is trying to acquire lock: ffff88801232eba0 (&sb->s_type->i_mutex_key#26/2){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline] ffff88801232eba0 (&sb->s_type->i_mutex_key#26/2){+.+.}-{4:4}, at: __ocfs2_reflink+0xace/0x16f0 fs/ocfs2/refcounttree.c:4174 but task is already holding lock: ffff88801232f658 (&oi->ip_alloc_sem){+.+.}-{4:4}, at: ocfs2_reflink+0x4d2/0x920 fs/ocfs2/refcounttree.c:4272 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&oi->ip_alloc_sem){+.+.}-{4:4}: down_write+0x96/0x200 kernel/locking/rwsem.c:1631 ocfs2_reflink+0x4d2/0x920 fs/ocfs2/refcounttree.c:4272 ocfs2_vfs_reflink+0x338/0x450 fs/ocfs2/refcounttree.c:4399 ocfs2_reflink_ioctl+0x3a0/0x450 fs/ocfs2/refcounttree.c:4439 ocfs2_ioctl+0x5b5/0x7e0 fs/ocfs2/ioctl.c:920 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&oi->ip_xattr_sem){++++}-{4:4}: down_write+0x96/0x200 kernel/locking/rwsem.c:1631 ocfs2_reflink+0x4c3/0x920 fs/ocfs2/refcounttree.c:4271 ocfs2_vfs_reflink+0x338/0x450 fs/ocfs2/refcounttree.c:4399 ocfs2_reflink_ioctl+0x3a0/0x450 fs/ocfs2/refcounttree.c:4439 ocfs2_ioctl+0x5b5/0x7e0 fs/ocfs2/ioctl.c:920 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&sb->s_type->i_mutex_key#27){+.+.}-{4:4}: down_write+0x96/0x200 kernel/locking/rwsem.c:1631 inode_lock include/linux/fs.h:1024 [inline] vfs_rename+0x6e3/0xef0 fs/namei.c:-1 filename_renameat2+0x533/0x9a0 fs/namei.c:6192 __do_sys_renameat2 fs/namei.c:6221 [inline] __se_sys_renameat2+0x5a/0x2c0 fs/namei.c:6216 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&sb->s_type->i_mutex_key#26/2){+.+.}-{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+0x1520/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868 down_write_nested+0x9d/0x210 kernel/locking/rwsem.c:1757 inode_lock_nested include/linux/fs.h:1069 [inline] __ocfs2_reflink+0xace/0x16f0 fs/ocfs2/refcounttree.c:4174 ocfs2_reflink+0x4eb/0x920 fs/ocfs2/refcounttree.c:4273 ocfs2_vfs_reflink+0x338/0x450 fs/ocfs2/refcounttree.c:4399 ocfs2_reflink_ioctl+0x3a0/0x450 fs/ocfs2/refcounttree.c:4439 ocfs2_ioctl+0x5b5/0x7e0 fs/ocfs2/ioctl.c:920 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#26/2 --> &oi->ip_xattr_sem --> &oi->ip_alloc_sem Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&oi->ip_alloc_sem); lock(&oi->ip_xattr_sem); lock(&oi->ip_alloc_sem); lock(&sb->s_type->i_mutex_key#26/2); *** DEADLOCK *** 5 locks held by syz.0.0/5321: #0: ffff888012e42450 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:494 #1: ffff88804422a5a0 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline] #1: ffff88804422a5a0 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2918 [inline] #1: ffff88804422a5a0 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2942 [inline] #1: ffff88804422a5a0 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: filename_create+0x200/0x370 fs/namei.c:4955 #2: ffff88801232f9a0 (&sb->s_type->i_mutex_key#27){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1024 [inline] #2: ffff88801232f9a0 (&sb->s_type->i_mutex_key#27){+.+.}-{4:4}, at: ocfs2_vfs_reflink+0x2f8/0x450 fs/ocfs2/refcounttree.c:4396 #3: ffff88801232f6e8 (&oi->ip_xattr_sem){++++}-{4:4}, at: ocfs2_reflink+0x4c3/0x920 fs/ocfs2/refcounttree.c:4271 #4: ffff88801232f658 (&oi->ip_alloc_sem){+.+.}-{4:4}, at: ocfs2_reflink+0x4d2/0x920 fs/ocfs2/refcounttree.c:4272 stack backtrace: CPU: 0 UID: 0 PID: 5321 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 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+0x1520/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868 down_write_nested+0x9d/0x210 kernel/locking/rwsem.c:1757 inode_lock_nested include/linux/fs.h:1069 [inline] __ocfs2_reflink+0xace/0x16f0 fs/ocfs2/refcounttree.c:4174 ocfs2_reflink+0x4eb/0x920 fs/ocfs2/refcounttree.c:4273 ocfs2_vfs_reflink+0x338/0x450 fs/ocfs2/refcounttree.c:4399 ocfs2_reflink_ioctl+0x3a0/0x450 fs/ocfs2/refcounttree.c:4439 ocfs2_ioctl+0x5b5/0x7e0 fs/ocfs2/ioctl.c:920 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f8ef099de99 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8ef18d8fe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f8ef0c25fa0 RCX: 00007f8ef099de99 RDX: 00002000000001c0 RSI: 0000000040186f04 RDI: 0000000000000007 RBP: 00007f8ef0a33eaf R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f8ef0c26038 R14: 00007f8ef0c25fa0 R15: 00007ffcbe196898