syzbot


possible deadlock in join_transaction (3)

Status: upstream: reported on 2025/12/08 00:54
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+c597e3e4382fe9c65845@syzkaller.appspotmail.com
First crash: 105d, last: 14d
✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision Error
a568803a-553a-4200-902c-7c53403714b4 repro possible deadlock in join_transaction (3) 2026/03/07 21:53 2026/03/07 21:53 2026/03/07 22:01 31e9c887f7dc24e04b3ca70d0d54fc34141844b0
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [btrfs?] possible deadlock in join_transaction (3) 0 (1) 2025/12/08 00:54
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in join_transaction (2) btrfs 4 4 457d 465d 0/29 auto-obsoleted due to no activity on 2025/03/26 23:03
upstream possible deadlock in join_transaction btrfs 4 23 633d 676d 0/29 auto-obsoleted due to no activity on 2024/09/01 23:05

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kworker/u8:11/1447 is trying to acquire lock:
ffff888032f53118 (btrfs_trans_num_writers){++++}-{0:0}, at: join_transaction+0x41b/0xc90 fs/btrfs/transaction.c:298

but task is already holding lock:
ffff888060720770 (sb_internal#4){.+.+}-{0:0}, at: __cow_file_range_inline+0x167/0x1240 fs/btrfs/inode.c:646

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #6 (sb_internal#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_intwrite include/linux/fs/super.h:177 [inline]
       start_transaction+0x56e/0x1650 fs/btrfs/transaction.c:702
       btrfs_dirty_inode+0x9f/0x190 fs/btrfs/inode.c:6429
       file_update_time_flags+0x2d5/0x4b0 fs/inode.c:2426
       btrfs_page_mkwrite+0x5df/0x1b10 fs/btrfs/file.c:1914
       do_page_mkwrite+0x150/0x310 mm/memory.c:3589
       wp_page_shared mm/memory.c:3990 [inline]
       do_wp_page+0x203b/0x49d0 mm/memory.c:4209
       handle_pte_fault mm/memory.c:6332 [inline]
       __handle_mm_fault mm/memory.c:6454 [inline]
       handle_mm_fault+0x9f5/0x13c0 mm/memory.c:6623
       do_user_addr_fault+0xa73/0x1340 arch/x86/mm/fault.c:1334
       handle_page_fault arch/x86/mm/fault.c:1474 [inline]
       exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618

-> #5 (sb_pagefaults#5){.+.+}-{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+0x329/0x1b10 fs/btrfs/file.c:1873
       do_page_mkwrite+0x150/0x310 mm/memory.c:3589
       wp_page_shared mm/memory.c:3990 [inline]
       do_wp_page+0x203b/0x49d0 mm/memory.c:4209
       handle_pte_fault mm/memory.c:6332 [inline]
       __handle_mm_fault mm/memory.c:6454 [inline]
       handle_mm_fault+0x9f5/0x13c0 mm/memory.c:6623
       do_user_addr_fault+0x75b/0x1340 arch/x86/mm/fault.c:1385
       handle_page_fault arch/x86/mm/fault.c:1474 [inline]
       exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618
       filldir64+0x2c0/0x670 fs/readdir.c:-1
       dir_emit include/linux/fs.h:3566 [inline]
       btrfs_filldir fs/btrfs/inode.c:6279 [inline]
       btrfs_real_readdir+0xffc/0x1400 fs/btrfs/inode.c:6377
       iterate_dir+0x3a5/0x580 fs/readdir.c:108
       __do_sys_getdents64 fs/readdir.c:412 [inline]
       __se_sys_getdents64+0xf1/0x280 fs/readdir.c:397
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #4 (&mm->mmap_lock){++++}-{4:4}:
       down_read_killable+0xa4/0x220 kernel/locking/rwsem.c:1560
       mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:601
       get_mmap_lock_carefully mm/mmap_lock.c:450 [inline]
       lock_mm_and_find_vma+0x2d7/0x340 mm/mmap_lock.c:501
       do_user_addr_fault+0x330/0x1340 arch/x86/mm/fault.c:1357
       handle_page_fault arch/x86/mm/fault.c:1474 [inline]
       exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1527
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618
       filldir+0x2b5/0x690 fs/readdir.c:295
       dir_emit include/linux/fs.h:3566 [inline]
       kernfs_fop_readdir+0x57e/0x8d0 fs/kernfs/dir.c:1915
       iterate_dir+0x3a5/0x580 fs/readdir.c:108
       __do_sys_getdents fs/readdir.c:327 [inline]
       __se_sys_getdents+0xf1/0x270 fs/readdir.c:312
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #3 (&root->kernfs_rwsem){++++}-{4:4}:
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1590
       kernfs_add_one+0x41/0x5c0 fs/kernfs/dir.c:796
       kernfs_create_dir_ns+0xde/0x130 fs/kernfs/dir.c:1098
       sysfs_create_dir_ns+0x12f/0x2a0 fs/sysfs/dir.c:59
       create_dir lib/kobject.c:73 [inline]
       kobject_add_internal+0x631/0xd10 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+0x116/0x2e0 fs/btrfs/sysfs.c:2604
       btrfs_quota_enable+0x282/0x2850 fs/btrfs/qgroup.c:1034
       btrfs_ioctl_quota_ctl+0x186/0x1c0 fs/btrfs/ioctl.c:3533
       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:63 [inline]
       do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&fs_info->qgroup_ioctl_lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline]
       mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552
       btrfs_quota_enable+0x2c6/0x2850 fs/btrfs/qgroup.c:1063
       btrfs_ioctl_quota_ctl+0x186/0x1c0 fs/btrfs/ioctl.c:3533
       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:63 [inline]
       do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (btrfs_trans_num_extwriters){++++}-{0:0}:
       join_transaction+0x1a4/0xc90 fs/btrfs/transaction.c:323
       start_transaction+0x6b9/0x1650 fs/btrfs/transaction.c:708
       btrfs_create_common+0x15c/0x310 fs/btrfs/inode.c:6948
       vfs_mknod+0x44e/0x620 fs/namei.c:5092
       filename_mknodat+0x3cf/0x670 fs/namei.c:-1
       __do_sys_mknod fs/namei.c:5179 [inline]
       __se_sys_mknod+0x3a/0x150 fs/namei.c:5176
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (btrfs_trans_num_writers){++++}-{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+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
       lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868
       join_transaction+0x43b/0xc90 fs/btrfs/transaction.c:298
       start_transaction+0x6b9/0x1650 fs/btrfs/transaction.c:708
       __cow_file_range_inline+0x167/0x1240 fs/btrfs/inode.c:646
       cow_file_range_inline+0x3b5/0x4b0 fs/btrfs/inode.c:724
       compress_file_range+0xcba/0x19b0 fs/btrfs/inode.c:1054
       btrfs_work_helper+0x38b/0xc70 fs/btrfs/async-thread.c:312
       process_one_work kernel/workqueue.c:3275 [inline]
       process_scheduled_works+0xb02/0x1830 kernel/workqueue.c:3358
       worker_thread+0xa50/0xfc0 kernel/workqueue.c:3439
       kthread+0x388/0x470 kernel/kthread.c:467
       ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

other info that might help us debug this:

Chain exists of:
  btrfs_trans_num_writers --> sb_pagefaults#5 --> sb_internal#4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_internal#4);
                               lock(sb_pagefaults#5);
                               lock(sb_internal#4);
  rlock(btrfs_trans_num_writers);

 *** DEADLOCK ***

3 locks held by kworker/u8:11/1447:
 #0: ffff888037077938 ((wq_completion)btrfs-delalloc){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3250 [inline]
 #0: ffff888037077938 ((wq_completion)btrfs-delalloc){+.+.}-{0:0}, at: process_scheduled_works+0x9ea/0x1830 kernel/workqueue.c:3358
 #1: ffffc9000628fc40 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3251 [inline]
 #1: ffffc9000628fc40 ((work_completion)(&work->normal_work)){+.+.}-{0:0}, at: process_scheduled_works+0xa25/0x1830 kernel/workqueue.c:3358
 #2: ffff888060720770 (sb_internal#4){.+.+}-{0:0}, at: __cow_file_range_inline+0x167/0x1240 fs/btrfs/inode.c:646

stack backtrace:
CPU: 1 UID: 0 PID: 1447 Comm: kworker/u8:11 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Workqueue: btrfs-delalloc btrfs_work_helper
Call Trace:
 <TASK>
 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+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
 lock_acquire+0xf0/0x2e0 kernel/locking/lockdep.c:5868
 join_transaction+0x43b/0xc90 fs/btrfs/transaction.c:298
 start_transaction+0x6b9/0x1650 fs/btrfs/transaction.c:708
 __cow_file_range_inline+0x167/0x1240 fs/btrfs/inode.c:646
 cow_file_range_inline+0x3b5/0x4b0 fs/btrfs/inode.c:724
 compress_file_range+0xcba/0x19b0 fs/btrfs/inode.c:1054
 btrfs_work_helper+0x38b/0xc70 fs/btrfs/async-thread.c:312
 process_one_work kernel/workqueue.c:3275 [inline]
 process_scheduled_works+0xb02/0x1830 kernel/workqueue.c:3358
 worker_thread+0xa50/0xfc0 kernel/workqueue.c:3439
 kthread+0x388/0x470 kernel/kthread.c:467
 ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/03/05 04:00 upstream ecc64d2dc9ff a9fe5c9e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in join_transaction
2025/12/04 00:51 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 05c93f3395ed d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in join_transaction
* Struck through repros no longer work on HEAD.