CVE-2026-53122: Linux btrfs Deadlock with Reflink and flushoncommit
A deadlock vulnerability exists in the Linux kernel's btrfs filesystem when the flushoncommit mount option is enabled. The issue occurs when a reflink operation (copy-on-write file cloning) interacts badly with the transaction commit process. Specifically, when copying inline file data to an offset beyond the current file size, a race condition can cause two kernel tasks to deadlock: one waiting on a file extent lock held by the other, while the other waits for a transaction to complete. This results in a system hang that can freeze processes and make the system unresponsive.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-667
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-24 / 2026-07-23
NVD description (verbatim)
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix deadlock between reflink and transaction commit when using flushoncommit When using the flushoncommit mount option, we can have a deadlock between a transaction commit and a reflink operation that copied an inline extent to an offset beyond the current i_size of the destination node. The deadlock happens like this: 1) Task A clones an inline extent from inode X to an offset of inode Y that is beyond Y's current i_size. This means we copied the inline extent's data to a folio of inode Y that is beyond its EOF, using a call to copy_inline_to_page(); 2) Task B starts a transaction commit and calls btrfs_start_delalloc_flush() to flush delalloc; 3) The delalloc flushing sees the new dirty folio of inode Y and when it attempts to flush it, it ends up at extent_writepage() and sees that the offset of the folio is beyond the i_size of inode Y, so it attempts to invalidate the folio by calling folio_invalidate(), which ends up at btrfs' folio invalidate callback - btrfs_invalidate_folio(). There it tries to lock the folio's range in inode Y's extent io tree, but it blocks since it's currently locked by task A - during a reflink we lock the inodes and the source and destination ranges after flushing all delalloc and waiting for ordered extent completion - after that we don't expect to have dirty folios in the ranges, the exception is if we have to copy an inline extent's data (because the destination offset is not zero); 4) Task A then attempts to start a transaction to update the inode item, and then it's blocked since the current transaction is in the TRANS_STATE_COMMIT_START state. Therefore task A has to wait for the current transaction to become unblocked (its state >= TRANS_STATE_UNBLOCKED). So task A is waiting for the transaction commit done by task B, and the later waiting on the extent lock of inode Y that is currently held by task A. Syzbot recently reported this with the following stack traces: INFO: task kworker/u8:7:1053 blocked for more than 143 seconds. Not tainted syzkaller #0 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:kworker/u8:7 state:D stack:23520 pid:1053 tgid:1053 ppid:2 task_flags:0x4208060 flags:0x00080000 Workqueue: writeback wb_workfn (flush-btrfs-46) Call Trace: <TASK> context_switch kernel/sched/core.c:5298 [inline] __schedule+0x1553/0x5240 kernel/sched/core.c:6911 __schedule_loop kernel/sched/core.c:6993 [inline] schedule+0x164/0x360 kernel/sched/core.c:7008 wait_extent_bit fs/btrfs/extent-io-tree.c:811 [inline] btrfs_lock_extent_bits+0x59c/0x700 fs/btrfs/extent-io-tree.c:1914 btrfs_lock_extent fs/btrfs/extent-io-tree.h:152 [inline] btrfs_invalidate_folio+0x43d/0xc40 fs/btrfs/inode.c:7704 extent_writepage fs/btrfs/extent_io.c:1852 [inline] extent_write_cache_pages fs/btrfs/extent_io.c:2580 [inline] btrfs_writepages+0x12ff/0x2440 fs/btrfs/extent_io.c:2713 do_writepages+0x32e/0x550 mm/page-writeback.c:2554 __writeback_single_inode+0x133/0x11a0 fs/fs-writeback.c:1750 writeback_sb_inodes+0x995/0x19d0 fs/fs-writeback.c:2042 wb_writeback+0x456/0xb70 fs/fs-writeback.c:2227 wb_do_writeback fs/fs-writeback.c:2374 [inline] wb_workfn+0x41a/0xf60 fs/fs-writeback.c:2414 process_one_work kernel/workqueue.c:3276 [inline] process_scheduled_works+0xb6e/0x18c0 kernel/workqueue.c:3359 worker_thread+0xa53/0xfc0 kernel/workqueue.c:3440 kthread+0x388/0x470 kernel/kthread.c:436 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> INFO: task syz.4.64:6910 blocked for more than 143 seconds. Not tainted syzkaller #0 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz.4.64 state:D stack:22752 pid:6910 tgid: ---truncated---
4 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability is a deadlock between btrfs transaction commit and reflink operations under flushoncommit. The sequence occurs when: (1) a reflink task copies an inline extent to a destination inode at an offset beyond its i_size via copy_inline_to_page(), creating a dirty folio; (2) a concurrent transaction commit calls btrfs_start_delalloc_flush() which triggers extent_writepage(); (3) the writepage handler sees the folio is beyond EOF and calls folio_invalidate(), invoking btrfs_invalidate_folio() which attempts to lock the extent; (4) the extent lock is held by the reflink task, which then tries to start a new transaction and blocks on TRANS_STATE_COMMIT_START. The result is circular wait: reflink waits for commit, commit waits for extent lock held by reflink. Syzbot confirmed this with kernel hang traces showing tasks stuck in wait_extent_bit and transaction state checks.
Business impact
This vulnerability enables a denial-of-service attack via local system access. An unprivileged user with filesystem access on a btrfs volume mounted with flushoncommit can trigger the deadlock, freezing critical processes and making the system unresponsive. This directly impacts availability of services relying on that filesystem. Affected organizations running btrfs with flushoncommit (a non-default option often used to ensure data durability in specific workloads) face unexpected system hangs. While data confidentiality and integrity are not directly compromised, system unavailability can cascade into broader service disruption.
Affected systems
The vulnerability affects Linux kernel systems using the btrfs filesystem with the flushoncommit mount option enabled. Any distribution or system deploying btrfs with this specific mount flag is potentially vulnerable. Note that flushoncommit is not the default btrfs mount mode, so systems using standard btrfs configurations are not at risk. Affected versions are those prior to the patch that resolves the deadlock condition; verify against the specific Linux distribution and kernel version advisories for affected and patched versions.
Exploitability
Exploitability is straightforward for local attackers with filesystem access. The attack requires only user-level privileges (not root) and can be triggered through reflink operations combined with concurrent filesystem writes. No special tools or exploit code are needed—an attacker can craft reflink operations and writes to induce the deadlock. The vulnerability is easily reproducible as evidenced by Syzbot's detection, meaning attack reliability is high. However, exploitation requires filesystem-level access and the specific mount option to be enabled, limiting exposure to systems where those conditions exist.
Remediation
Apply the kernel patch that resolves the deadlock by properly handling extent locking during reflink operations when dealing with inline extents beyond the destination file's i_size. The fix prevents the race by ensuring extent locks are not held in a way that conflicts with transaction commit serialization. Organizations should: (1) identify systems running btrfs with flushoncommit; (2) update to a patched kernel version (verify version numbers against distribution advisories); (3) test in staging before production rollout to ensure stability.
Patch guidance
Patches are available in updated Linux kernel releases. To remediate: (1) check your current kernel version with 'uname -r'; (2) consult your Linux distribution's security advisory for CVE-2026-53122 to identify patched versions; (3) apply the kernel update through your distribution's package manager (apt, yum, etc.); (4) reboot to activate the patched kernel. For distributions providing backported fixes, patches may be available for multiple stable kernel series. Test the update in a non-production environment first, particularly if btrfs with flushoncommit is critical to your workload.
Detection guidance
Monitor for hung or blocked kernel tasks using 'dmesg' for blocked task warnings mentioning btrfs operations, specifically btrfs_invalidate_folio or wait_extent_bit. System-level indicators include high load with no apparent CPU usage, processes stuck in 'D' (uninterruptible) state shown by 'ps', and filesystem I/O stalls. Log analysis should flag task hang detector warnings over 120+ seconds for kernel workers on btrfs volumes. In production, enable kernel task watchdog and monitor hung_task_timeout_secs alerts. Correlate hangs with reflink operations (cp --reflink or similar) on btrfs volumes mounted with flushoncommit to identify exploitation attempts.
Why prioritize this
Despite a MEDIUM CVSS score, this vulnerability warrants prompt attention because: (1) availability impact is complete denial-of-service via system hang, affecting all services on the filesystem; (2) exploitability is trivial, requiring only local access and standard operations; (3) the condition is easily reproducible, as demonstrated by Syzbot; (4) however, it requires a non-default mount option (flushoncommit), limiting blast radius. Organizations using btrfs with flushoncommit should prioritize patching; others may defer but should eventually apply the update. The vulnerability does not enable privilege escalation or data theft, limiting severity relative to other kernel flaws.
Risk score, explained
The CVSS 5.5 MEDIUM score reflects: Attack Vector=Local (no network), Access Complexity=Low (easy trigger), Privileges Required=Low (unprivileged user can trigger), User Interaction=None, Scope=Unchanged (impact limited to one system), Confidentiality=None, Integrity=None, Availability=High (complete DoS). The score is calibrated to denial-of-service severity with local-only attack scope. However, context matters: organizations not using flushoncommit face zero risk; those using it face significant availability risk. The reproducibility and ease of exploitation increase practical severity despite the moderate CVSS rating.
Frequently asked questions
Does this affect standard btrfs installations?
No. The vulnerability only manifests when btrfs is mounted with the flushoncommit option. Standard btrfs mounts do not have this flag enabled by default and are not vulnerable. Check your mount options with 'mount | grep btrfs' to confirm whether flushoncommit is in use.
Can this be exploited remotely?
No, this is a local privilege escalation cannot occur. Exploitation requires direct filesystem access and user-level privileges on the affected system. Remote exploitation is not possible.
What does the flushoncommit option do, and why use it?
flushoncommit forces btrfs to flush all delalloc (dirty pages) during transaction commits, ensuring data durability synchronously. It's used in workloads demanding strong durability guarantees, such as databases or high-availability clusters, at the cost of reduced performance. Most general-purpose systems do not enable it.
If I disable flushoncommit, am I safe?
Yes. Disabling flushoncommit eliminates the vulnerability condition, though you lose the durability guarantees that option provides. You can change the mount option via 'mount -o remount,noflushoncommit' without rebooting, though verify the option in /etc/fstab or your mount configuration to prevent re-enabling at the next reboot.
This analysis is based on the CVE description and kernel source as of the publication date. Actual affected kernel versions and patch availability depend on your Linux distribution—consult official distribution advisories for specific version numbers and timelines. Testing patches in a non-production environment is strongly recommended before deployment. This vulnerability does not enable remote code execution or privilege escalation; exploitation is limited to local users with filesystem access. For production systems, coordinate patching with your change management process, especially if btrfs with flushoncommit is critical to your workload. Source: NVD (public-domain), retrieved 2026-08-02. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-46156MEDIUMLinux Kernel Loongson GPU Driver ADE Panic on Loongarch
- CVE-2026-46165MEDIUMLinux Kernel Open vSwitch Vport Deadlock Denial of Service
- CVE-2026-46223MEDIUMLinux Kernel Cgroup Deadlock During Container Teardown
- CVE-2026-46252MEDIUMLinux Kernel Regulator Locking Vulnerability
- CVE-2026-46256MEDIUMLinux NFS LOCALIO Recursion Deadlock Vulnerability
- CVE-2026-46262MEDIUMLinux Kernel fsl_xcvr Audio Driver Deadlock Vulnerability
- CVE-2026-52979MEDIUMLinux Kernel PSP Device Unregister Race Condition Denial of Service
- CVE-2026-53035MEDIUMLinux Kernel eBPF Socket Map Deadlock DoS Vulnerability