====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.890/19294 is trying to acquire lock: ffff88801314a368 (&fs_info->qgroup_ioctl_lock){+.+.}-{4:4}, at: btrfs_quota_enable+0x2b1/0x1e20 fs/btrfs/qgroup.c:1061 but task is already holding lock: ffff88801314b1b8 (btrfs_trans_num_extwriters){++++}-{0:0}, at: join_transaction+0x14c/0xc60 fs/btrfs/transaction.c:323 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x18a/0xc60 fs/btrfs/transaction.c:324 start_transaction+0x6ed/0x17d0 fs/btrfs/transaction.c:730 btrfs_create_common+0x15c/0x310 fs/btrfs/inode.c:7003 btrfs_mkdir+0xc1/0xf0 fs/btrfs/inode.c:7148 vfs_mkdir+0x408/0x620 fs/namei.c:5409 filename_mkdirat+0x289/0x520 fs/namei.c:5442 __do_sys_mkdirat fs/namei.c:5463 [inline] __se_sys_mkdirat+0x35/0x150 fs/namei.c:5460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (btrfs_trans_num_writers){++++}-{0:0}: __lock_release kernel/locking/lockdep.c:5627 [inline] lock_release+0x1a3/0x3c0 kernel/locking/lockdep.c:5964 percpu_up_read include/linux/percpu-rwsem.h:114 [inline] __sb_end_write include/linux/fs/super.h:14 [inline] sb_end_intwrite+0x26/0x190 include/linux/fs/super.h:101 __btrfs_end_transaction+0x23f/0x640 fs/btrfs/transaction.c:1107 btrfs_dirty_inode+0x14c/0x190 fs/btrfs/inode.c:6479 touch_atime+0x2f8/0x670 fs/inode.c:2325 file_accessed include/linux/fs.h:2279 [inline] btrfs_file_mmap_prepare+0x189/0x200 fs/btrfs/file.c:2003 vfs_mmap_prepare include/linux/fs.h:2071 [inline] call_mmap_prepare mm/vma.c:2799 [inline] __mmap_region mm/vma.c:2888 [inline] mmap_region+0xebb/0x25c0 mm/vma.c:2989 do_mmap+0xe0e/0x1310 mm/mmap.c:573 vm_mmap_pgoff+0x275/0x4e0 mm/util.c:581 ksys_mmap_pgoff+0x4a6/0x720 mm/mmap.c:619 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&mm->mmap_lock){++++}-{4:4}: down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1599 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:609 get_mmap_lock_carefully mm/mmap_lock.c:450 [inline] lock_mm_and_find_vma+0x2d6/0x340 mm/mmap_lock.c:501 do_user_addr_fault+0x343/0x1340 arch/x86/mm/fault.c:1366 handle_page_fault arch/x86/mm/fault.c:1483 [inline] exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1536 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595 filldir64+0x2b1/0x620 fs/readdir.c:-1 dir_emit include/linux/fs.h:3610 [inline] kernfs_fop_readdir+0x583/0x960 fs/kernfs/dir.c:1999 iterate_dir+0x3ea/0x8a0 fs/readdir.c:114 __do_sys_getdents64 fs/readdir.c:404 [inline] __se_sys_getdents64+0xf1/0x280 fs/readdir.c:389 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&root->kernfs_rwsem){++++}-{4:4}: down_write+0x3a/0x50 kernel/locking/rwsem.c:1631 kernfs_add_one+0x41/0x6f0 fs/kernfs/dir.c:825 kernfs_create_dir_ns+0x1a1/0x230 fs/kernfs/dir.c:1130 sysfs_create_dir_ns+0x12f/0x2a0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x62c/0xce0 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_init_and_add+0x12b/0x1a0 lib/kobject.c:457 btrfs_sysfs_add_qgroups+0x118/0x2f0 fs/btrfs/sysfs.c:2604 btrfs_quota_enable+0x274/0x1e20 fs/btrfs/qgroup.c:1032 btrfs_ioctl_quota_ctl+0x189/0x1f0 fs/btrfs/ioctl.c:3581 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&fs_info->qgroup_ioctl_lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 __mutex_lock_common kernel/locking/rtmutex_api.c:561 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:580 btrfs_quota_enable+0x2b1/0x1e20 fs/btrfs/qgroup.c:1061 btrfs_ioctl_quota_ctl+0x189/0x1f0 fs/btrfs/ioctl.c:3581 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &fs_info->qgroup_ioctl_lock --> btrfs_trans_num_writers --> btrfs_trans_num_extwriters Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(btrfs_trans_num_extwriters); lock(btrfs_trans_num_writers); lock(btrfs_trans_num_extwriters); lock(&fs_info->qgroup_ioctl_lock); *** DEADLOCK *** locks held by syz.3.890/19294: 5, last CPU#0: #0: ffff888012f1e510 (sb_writers#20){++++}-{0:0}, at: mnt_want_write_file+0x63/0x210 fs/namespace.c:575 #1: ffff8880131491b8 (&fs_info->subvol_sem){+.+.}-{4:4}, at: btrfs_ioctl_quota_ctl+0x17e/0x1f0 fs/btrfs/ioctl.c:3580 #2: ffff888012f1e800 (sb_internal#5){++++}-{0:0}, at: btrfs_quota_enable+0x2a4/0x1e20 fs/btrfs/qgroup.c:1059 #3: ffff88801314b190 (btrfs_trans_num_writers){++++}-{0:0}, at: join_transaction+0x14c/0xc60 fs/btrfs/transaction.c:323 #4: ffff88801314b1b8 (btrfs_trans_num_extwriters){++++}-{0:0}, at: join_transaction+0x14c/0xc60 fs/btrfs/transaction.c:323 stack backtrace: CPU: 0 UID: 0 PID: 19294 Comm: syz.3.890 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 __mutex_lock_common kernel/locking/rtmutex_api.c:561 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:580 btrfs_quota_enable+0x2b1/0x1e20 fs/btrfs/qgroup.c:1061 btrfs_ioctl_quota_ctl+0x189/0x1f0 fs/btrfs/ioctl.c:3581 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff242c4e559 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:00007ff240ea6028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007ff242ed5fa0 RCX: 00007ff242c4e559 RDX: 0000200000009040 RSI: 00000000c0109428 RDI: 0000000000000004 RBP: 00007ff242ce5ad8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ff242ed6038 R14: 00007ff242ed5fa0 R15: 00007ffe67c3eb08 BTRFS info (device loop3): setting incompat feature flag for SIMPLE_QUOTA (0x10000)