BTRFS info (device loop2): setting incompat feature flag for COMPRESS_ZSTD (0x10) BTRFS info (device loop2): use zstd compression, level 3 BTRFS info (device loop2): force zstd compression, level 3 BTRFS info (device loop2): has skinny extents BTRFS info (device loop2): clearing free space tree BTRFS info (device loop2): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1) BTRFS info (device loop2): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2) ====================================================== WARNING: possible circular locking dependency detected 5.15.176-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.15/2733 is trying to acquire lock: ffff888178174628 (sb_internal#2){.+.+}-{0:0}, at: btrfs_dirty_inode+0x43/0xe0 fs/btrfs/inode.c:6436 but task is already holding lock: ffff8881771b8610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] ffff8881771b8610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: chown_common+0x145/0x280 fs/open.c:674 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&type->i_mutex_dir_key#8){++++}-{3:3}: down_read+0x23/0xd0 kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:799 [inline] lookup_slow fs/namei.c:1679 [inline] walk_component+0x13d/0x1c0 fs/namei.c:1976 lookup_last fs/namei.c:2431 [inline] path_lookupat+0x69/0x1b0 fs/namei.c:2455 filename_lookup+0xc6/0x1d0 fs/namei.c:2484 kern_path+0x29/0x40 fs/namei.c:2582 lookup_bdev+0x32/0xb0 block/bdev.c:979 device_matched fs/btrfs/volumes.c:568 [inline] btrfs_free_stale_devices+0x1a9/0x460 fs/btrfs/volumes.c:608 btrfs_forget_devices+0x2b/0x50 fs/btrfs/volumes.c:1431 btrfs_control_ioctl+0x69/0x170 fs/btrfs/super.c:2451 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x7b/0xb0 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (&fs_devs->device_list_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 btrfs_run_dev_stats+0x41/0x4a0 fs/btrfs/volumes.c:7985 commit_cowonly_roots+0x9f/0x2a0 fs/btrfs/transaction.c:1290 btrfs_commit_transaction+0x46f/0xb00 fs/btrfs/transaction.c:2392 btrfs_start_pre_rw_mount.cold+0x7e/0xfd fs/btrfs/disk-io.c:3079 open_ctree+0x1634/0x186f fs/btrfs/disk-io.c:3634 btrfs_fill_super fs/btrfs/super.c:1387 [inline] btrfs_mount_root.cold+0x12/0xde fs/btrfs/super.c:1752 legacy_get_tree+0x28/0x50 fs/fs_context.c:611 vfs_get_tree+0x18/0x70 fs/super.c:1530 fc_mount fs/namespace.c:1000 [inline] vfs_kern_mount.part.0+0x6c/0xb0 fs/namespace.c:1030 btrfs_mount+0x118/0x390 fs/btrfs/super.c:1812 legacy_get_tree+0x28/0x50 fs/fs_context.c:611 vfs_get_tree+0x18/0x70 fs/super.c:1530 do_new_mount fs/namespace.c:3012 [inline] path_mount+0x2b9/0xb50 fs/namespace.c:3342 do_mount fs/namespace.c:3355 [inline] __do_sys_mount fs/namespace.c:3563 [inline] __se_sys_mount fs/namespace.c:3540 [inline] __x64_sys_mount+0xfe/0x140 fs/namespace.c:3540 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&fs_info->tree_log_mutex){+.+.}-{3:3}: __lock_release kernel/locking/lockdep.c:5339 [inline] lock_release+0x101/0x220 kernel/locking/lockdep.c:5643 __mutex_unlock_slowpath+0x37/0x1e0 kernel/locking/mutex.c:851 btrfs_commit_transaction+0x6bd/0xb00 fs/btrfs/transaction.c:2439 btrfs_start_pre_rw_mount.cold+0x7e/0xfd fs/btrfs/disk-io.c:3079 open_ctree+0x1634/0x186f fs/btrfs/disk-io.c:3634 btrfs_fill_super fs/btrfs/super.c:1387 [inline] btrfs_mount_root.cold+0x12/0xde fs/btrfs/super.c:1752 legacy_get_tree+0x28/0x50 fs/fs_context.c:611 vfs_get_tree+0x18/0x70 fs/super.c:1530 fc_mount fs/namespace.c:1000 [inline] vfs_kern_mount.part.0+0x6c/0xb0 fs/namespace.c:1030 btrfs_mount+0x118/0x390 fs/btrfs/super.c:1812 legacy_get_tree+0x28/0x50 fs/fs_context.c:611 vfs_get_tree+0x18/0x70 fs/super.c:1530 do_new_mount fs/namespace.c:3012 [inline] path_mount+0x2b9/0xb50 fs/namespace.c:3342 do_mount fs/namespace.c:3355 [inline] __do_sys_mount fs/namespace.c:3563 [inline] __se_sys_mount fs/namespace.c:3540 [inline] __x64_sys_mount+0xfe/0x140 fs/namespace.c:3540 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (sb_internal#2){.+.+}-{0:0}: 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+0x10b6/0x1a40 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5623 [inline] lock_acquire+0xbb/0x290 kernel/locking/lockdep.c:5588 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1813 [inline] sb_start_intwrite include/linux/fs.h:1930 [inline] start_transaction+0x3e5/0x6a0 fs/btrfs/transaction.c:678 btrfs_dirty_inode+0x43/0xe0 fs/btrfs/inode.c:6436 btrfs_setattr+0x2e8/0x6e0 fs/btrfs/inode.c:5495 notify_change+0x1f8/0x500 fs/attr.c:505 chown_common+0x23d/0x280 fs/open.c:680 do_fchownat+0x88/0xe0 fs/open.c:711 __do_sys_lchown fs/open.c:736 [inline] __se_sys_lchown fs/open.c:734 [inline] __x64_sys_lchown+0x1c/0x20 fs/open.c:734 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: sb_internal#2 --> &fs_devs->device_list_mutex --> &type->i_mutex_dir_key#8 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&type->i_mutex_dir_key#8); lock(&fs_devs->device_list_mutex); lock(&type->i_mutex_dir_key#8); lock(sb_internal#2); *** DEADLOCK *** 2 locks held by syz.2.15/2733: #0: ffff888178174438 (sb_writers#13){.+.+}-{0:0}, at: do_fchownat+0x73/0xe0 fs/open.c:708 #1: ffff8881771b8610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #1: ffff8881771b8610 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: chown_common+0x145/0x280 fs/open.c:674 stack backtrace: CPU: 0 PID: 2733 Comm: syz.2.15 Not tainted 5.15.176-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 check_noncircular+0xcc/0xe0 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+0x10b6/0x1a40 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5623 [inline] lock_acquire+0xbb/0x290 kernel/locking/lockdep.c:5588 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1813 [inline] sb_start_intwrite include/linux/fs.h:1930 [inline] start_transaction+0x3e5/0x6a0 fs/btrfs/transaction.c:678 btrfs_dirty_inode+0x43/0xe0 fs/btrfs/inode.c:6436 btrfs_setattr+0x2e8/0x6e0 fs/btrfs/inode.c:5495 notify_change+0x1f8/0x500 fs/attr.c:505 chown_common+0x23d/0x280 fs/open.c:680 do_fchownat+0x88/0xe0 fs/open.c:711 __do_sys_lchown fs/open.c:736 [inline] __se_sys_lchown fs/open.c:734 [inline] __x64_sys_lchown+0x1c/0x20 fs/open.c:734 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fa453baced9 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:00007fa452e2b058 EFLAGS: 00000246 ORIG_RAX: 000000000000005e RAX: ffffffffffffffda RBX: 00007fa453d72fa0 RCX: 00007fa453baced9 RDX: 0000000000000000 RSI: 000000000000ee00 RDI: 0000000020000000 RBP: 00007fa453c20cc8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fa453d72fa0 R15: 00007fff84ef3348