====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.4.1182/9148 is trying to acquire lock: ffff88807502ea28 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x90/0x110 mm/memory.c:5356 but task is already holding lock: ffff888060d5b090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x75/0xd0 fs/reiserfs/lock.c:27 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&sbi->lock){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 reiserfs_write_lock+0x75/0xd0 fs/reiserfs/lock.c:27 reiserfs_lookup+0x137/0x420 fs/reiserfs/namei.c:364 __lookup_slow+0x27d/0x3d0 fs/namei.c:1671 lookup_one_len+0x18e/0x2c0 fs/namei.c:2726 reiserfs_lookup_privroot+0x85/0x1e0 fs/reiserfs/xattr.c:980 reiserfs_fill_super+0x1f65/0x23e0 fs/reiserfs/super.c:2178 mount_bdev+0x287/0x3c0 fs/super.c:1400 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611 vfs_get_tree+0x88/0x270 fs/super.c:1530 do_new_mount+0x24a/0xa40 fs/namespace.c:3034 do_mount fs/namespace.c:3377 [inline] __do_sys_mount fs/namespace.c:3585 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3562 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #4 (&type->i_mutex_dir_key#15){++++}-{3:3}: down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:797 [inline] lookup_slow+0x46/0x70 fs/namei.c:1687 walk_component+0x319/0x460 fs/namei.c:1984 lookup_last fs/namei.c:2439 [inline] path_lookupat+0x169/0x440 fs/namei.c:2463 filename_lookup+0x1e2/0x4f0 fs/namei.c:2492 kern_path+0x37/0x190 fs/namei.c:2590 lookup_bdev+0xbd/0x270 block/bdev.c:982 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x6db/0xa60 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x52/0x80 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x104/0x220 fs/btrfs/super.c:2450 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #3 (&fs_devs->device_list_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 btrfs_run_dev_stats+0xdf/0xdf0 fs/btrfs/volumes.c:7991 commit_cowonly_roots+0x17e/0x9c0 fs/btrfs/transaction.c:1292 btrfs_commit_transaction+0x1229/0x3440 fs/btrfs/transaction.c:2394 close_ctree+0x3d5/0x8c0 fs/btrfs/disk-io.c:4470 generic_shutdown_super+0x130/0x300 fs/super.c:475 kill_anon_super+0x36/0x70 fs/super.c:1089 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x418/0x4d0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (&fs_info->tree_log_mutex){+.+.}-{3:3}: __lock_release kernel/locking/lockdep.c:5339 [inline] lock_release+0x31a/0x870 kernel/locking/lockdep.c:5643 __mutex_unlock_slowpath+0xb3/0x6a0 kernel/locking/mutex.c:851 btrfs_commit_transaction+0x1c11/0x3440 fs/btrfs/transaction.c:2441 close_ctree+0x3d5/0x8c0 fs/btrfs/disk-io.c:4470 generic_shutdown_super+0x130/0x300 fs/super.c:475 kill_anon_super+0x36/0x70 fs/super.c:1089 btrfs_kill_super+0x3d/0x50 fs/btrfs/super.c:2390 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x418/0x4d0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (sb_internal#2){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1811 [inline] sb_start_intwrite include/linux/fs.h:1928 [inline] start_transaction+0x5bc/0x1130 fs/btrfs/transaction.c:680 btrfs_dirty_inode+0xc5/0x1c0 fs/btrfs/inode.c:6451 inode_update_time fs/inode.c:1893 [inline] touch_atime+0x2f6/0x620 fs/inode.c:1966 file_accessed include/linux/fs.h:2522 [inline] btrfs_file_mmap+0xc1/0x120 fs/btrfs/file.c:2449 call_mmap include/linux/fs.h:2178 [inline] mmap_file+0x5d/0xb0 mm/util.c:1092 __mmap_region mm/mmap.c:1796 [inline] mmap_region+0xf8f/0x1660 mm/mmap.c:2933 do_mmap+0x81f/0xea0 mm/mmap.c:1586 vm_mmap_pgoff+0x1b2/0x2b0 mm/util.c:551 ksys_mmap_pgoff+0x542/0x780 mm/mmap.c:1635 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __might_fault+0xb3/0x110 mm/memory.c:5357 reiserfs_ioctl+0x13b/0x330 fs/reiserfs/ioctl.c:96 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &type->i_mutex_dir_key#15 --> &sbi->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->lock); lock(&type->i_mutex_dir_key#15); lock(&sbi->lock); lock(&mm->mmap_lock); *** DEADLOCK *** 1 lock held by syz.4.1182/9148: #0: ffff888060d5b090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x75/0xd0 fs/reiserfs/lock.c:27 stack backtrace: CPU: 1 PID: 9148 Comm: syz.4.1182 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __might_fault+0xb3/0x110 mm/memory.c:5357 reiserfs_ioctl+0x13b/0x330 fs/reiserfs/ioctl.c:96 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f3c2a7b0749 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:00007f3c28a17038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f3c2aa06fa0 RCX: 00007f3c2a7b0749 RDX: 0000200000000000 RSI: 0000000080087601 RDI: 0000000000000004 RBP: 00007f3c2a834f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f3c2aa07038 R14: 00007f3c2aa06fa0 R15: 00007fff6ae0a188