====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ kworker/u8:7/27912 is trying to acquire lock: ffff8880b26cc610 (sb_internal#2){.+.+}-{0:0}, at: btrfs_finish_one_ordered+0x7b0/0x2170 fs/btrfs/inode.c:3163 but task is already holding lock: ffff88803f136648 (btrfs_ordered_extent){++++}-{0:0}, at: btrfs_finish_one_ordered+0x30b/0x2170 fs/btrfs/inode.c:3125 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #8 (btrfs_ordered_extent){++++}-{0:0}: btrfs_start_ordered_extent_nowriteback+0x38c/0x6c0 fs/btrfs/ordered-data.c:891 btrfs_start_ordered_extent fs/btrfs/ordered-data.h:199 [inline] btrfs_wait_ordered_range+0x154/0x260 fs/btrfs/ordered-data.c:943 btrfs_sync_file+0x6cc/0x1140 fs/btrfs/file.c:1664 generic_write_sync include/linux/fs.h:2616 [inline] btrfs_do_write_iter+0x689/0x820 fs/btrfs/file.c:1470 iter_file_splice_write+0x972/0x10b0 fs/splice.c:738 do_splice_from fs/splice.c:938 [inline] direct_splice_actor+0x101/0x160 fs/splice.c:1161 splice_direct_to_actor+0x5a8/0xcc0 fs/splice.c:1105 do_splice_direct_actor fs/splice.c:1204 [inline] do_splice_direct+0x181/0x270 fs/splice.c:1230 do_sendfile+0x4da/0x7e0 fs/read_write.c:1370 __do_sys_sendfile64 fs/read_write.c:1431 [inline] __se_sys_sendfile64+0x13e/0x190 fs/read_write.c:1417 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #7 (&ei->i_mmap_lock){++++}-{4:4}: down_read+0x47/0x2e0 kernel/locking/rwsem.c:1537 btrfs_page_mkwrite+0x5f3/0x1a70 fs/btrfs/file.c:1920 do_page_mkwrite+0x14d/0x310 mm/memory.c:3528 do_shared_fault mm/memory.c:5831 [inline] do_fault mm/memory.c:5893 [inline] do_pte_missing+0x795/0x3330 mm/memory.c:4401 handle_pte_fault mm/memory.c:6273 [inline] __handle_mm_fault mm/memory.c:6411 [inline] handle_mm_fault+0x1b26/0x32b0 mm/memory.c:6580 do_user_addr_fault+0x764/0x1380 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x71/0xd0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 -> #6 (sb_pagefaults#4){.+.+}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_pagefault include/linux/fs/super.h:159 [inline] btrfs_page_mkwrite+0x317/0x1a70 fs/btrfs/file.c:1875 do_page_mkwrite+0x14d/0x310 mm/memory.c:3528 do_shared_fault mm/memory.c:5831 [inline] do_fault mm/memory.c:5893 [inline] do_pte_missing+0x795/0x3330 mm/memory.c:4401 handle_pte_fault mm/memory.c:6273 [inline] __handle_mm_fault mm/memory.c:6411 [inline] handle_mm_fault+0x1b26/0x32b0 mm/memory.c:6580 do_user_addr_fault+0x764/0x1380 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x71/0xd0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 -> #5 (&mm->mmap_lock){++++}-{4:4}: down_read_killable+0x50/0x350 kernel/locking/rwsem.c:1560 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:400 get_mmap_lock_carefully mm/mmap_lock.c:399 [inline] lock_mm_and_find_vma+0x2a8/0x300 mm/mmap_lock.c:450 do_user_addr_fault+0x331/0x1380 arch/x86/mm/fault.c:1359 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x71/0xd0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 filldir+0x2b6/0x6c0 fs/readdir.c:295 dir_emit include/linux/fs.h:3527 [inline] kernfs_fop_readdir+0x537/0x870 fs/kernfs/dir.c:1913 iterate_dir+0x399/0x570 fs/readdir.c:108 __do_sys_getdents fs/readdir.c:326 [inline] __se_sys_getdents+0xe4/0x250 fs/readdir.c:312 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&root->kernfs_rwsem){++++}-{4:4}: down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 kernfs_add_one+0x41/0x5c0 fs/kernfs/dir.c:794 kernfs_create_dir_ns+0xde/0x130 fs/kernfs/dir.c:1096 sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x6ab/0xcc0 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_init_and_add+0x125/0x190 lib/kobject.c:457 btrfs_sysfs_add_qgroups+0x111/0x2b0 fs/btrfs/sysfs.c:2697 btrfs_quota_enable+0x25d/0x28f0 fs/btrfs/qgroup.c:1002 btrfs_ioctl_quota_ctl+0x183/0x1c0 fs/btrfs/ioctl.c:3613 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+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&fs_info->qgroup_ioctl_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:776 btrfs_quota_enable+0x29c/0x28f0 fs/btrfs/qgroup.c:1031 btrfs_ioctl_quota_ctl+0x183/0x1c0 fs/btrfs/ioctl.c:3613 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+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (btrfs_trans_num_extwriters){++++}-{0:0}: join_transaction+0x1a4/0xd60 fs/btrfs/transaction.c:323 start_transaction+0x6b7/0x15f0 fs/btrfs/transaction.c:707 btrfs_create_common+0x146/0x2f0 fs/btrfs/inode.c:6838 lookup_open fs/namei.c:4440 [inline] open_last_lookups fs/namei.c:4540 [inline] path_openat+0x18bb/0x3dd0 fs/namei.c:4784 do_filp_open+0x1fa/0x410 fs/namei.c:4814 do_sys_openat2+0x121/0x200 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (btrfs_trans_num_writers){++++}-{0:0}: join_transaction+0x182/0xd60 fs/btrfs/transaction.c:322 start_transaction+0x6b7/0x15f0 fs/btrfs/transaction.c:707 btrfs_create_common+0x146/0x2f0 fs/btrfs/inode.c:6838 lookup_open fs/namei.c:4440 [inline] open_last_lookups fs/namei.c:4540 [inline] path_openat+0x18bb/0x3dd0 fs/namei.c:4784 do_filp_open+0x1fa/0x410 fs/namei.c:4814 do_sys_openat2+0x121/0x200 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (sb_internal#2){.+.+}-{0:0}: 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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x107/0x340 kernel/locking/lockdep.c:5868 percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_intwrite include/linux/fs/super.h:177 [inline] start_transaction+0x56f/0x15f0 fs/btrfs/transaction.c:701 btrfs_finish_one_ordered+0x7b0/0x2170 fs/btrfs/inode.c:3163 btrfs_work_helper+0x38c/0xbf0 fs/btrfs/async-thread.c:312 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x510/0xa50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 other info that might help us debug this: Chain exists of: sb_internal#2 --> &ei->i_mmap_lock --> btrfs_ordered_extent Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(btrfs_ordered_extent); lock(&ei->i_mmap_lock); lock(btrfs_ordered_extent); rlock(sb_internal#2); *** DEADLOCK *** 3 locks held by kworker/u8:7/27912: #0: ffff88807afaf148 ((wq_completion)btrfs-endio-write){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3232 [inline] #0: ffff88807afaf148 ((wq_completion)btrfs-endio-write){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x1770 kernel/workqueue.c:3340 #1: ffffc9000b357bc0 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3233 [inline] #1: ffffc9000b357bc0 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x1770 kernel/workqueue.c:3340 #2: ffff88803f136648 (btrfs_ordered_extent){++++}-{0:0}, at: btrfs_finish_one_ordered+0x30b/0x2170 fs/btrfs/inode.c:3125 stack backtrace: CPU: 0 UID: 0 PID: 27912 Comm: kworker/u8:7 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Workqueue: btrfs-endio-write btrfs_work_helper Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x107/0x340 kernel/locking/lockdep.c:5868 percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_intwrite include/linux/fs/super.h:177 [inline] start_transaction+0x56f/0x15f0 fs/btrfs/transaction.c:701 btrfs_finish_one_ordered+0x7b0/0x2170 fs/btrfs/inode.c:3163 btrfs_work_helper+0x38c/0xbf0 fs/btrfs/async-thread.c:312 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x510/0xa50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246