# CVE-2021-47510: btrfs: fix re-dirty process of tree-log nodes

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.27% (percentile 12, 2026-11-26)
- **Published:** 2024-05-24T15:09:26.019Z
- **Modified:** 2026-06-17T04:17:39.563Z

## Who should check

- Anyone running Linux \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 477675049ca803aa95ff77468ffbddd966b415b0; \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 84c25448929942edacba905cecc0474e91114e7a
- Anyone running Linux 5.12

## Description

In the Linux kernel, the following vulnerability has been resolved:

btrfs: fix re-dirty process of tree-log nodes

There is a report of a transaction abort of -EAGAIN with the following
script.

  \#!/bin/sh

  for d in sda sdb; do
          mkfs.btrfs -d single -m single -f /dev/\\${d}
  done

  mount /dev/sda /mnt/test
  mount /dev/sdb /mnt/scratch

  for dir in test scratch; do
          echo 3 \>/proc/sys/vm/drop\_caches
          fio --directory=/mnt/\\${dir} --name=fio.\\${dir} --rw=read --size=50G --bs=64m \\
                  --numjobs=$(nproc) --time\_based --ramp\_time=5 --runtime=480 \\
                  --group\_reporting \|& tee /dev/shm/fio.\\${dir}
          echo 3 \>/proc/sys/vm/drop\_caches
  done

  for d in sda sdb; do
          umount /dev/\\${d}
  done

The stack trace is shown in below.

  \[3310.967991\] BTRFS: error (device sda) in btrfs\_commit\_transaction:2341: errno=-11 unknown (Error while writing out transaction)
  \[3310.968060\] BTRFS info (device sda): forced readonly
  \[3310.968064\] BTRFS warning (device sda): Skipping commit of aborted transaction.
  \[3310.968065\] ------------\[ cut here \]------------
  \[3310.968066\] BTRFS: Transaction aborted (error -11)
  \[3310.968074\] WARNING: CPU: 14 PID: 1684 at fs/btrfs/transaction.c:1946 btrfs\_commit\_transaction.cold+0x209/0x2c8
  \[3310.968131\] CPU: 14 PID: 1684 Comm: fio Not tainted 5.14.10-300.fc35.x86\_64 \#1
  \[3310.968135\] Hardware name: DIAWAY Tartu/Tartu, BIOS V2.01.B10 04/08/2021
  \[3310.968137\] RIP: 0010:btrfs\_commit\_transaction.cold+0x209/0x2c8
  \[3310.968144\] RSP: 0018:ffffb284ce393e10 EFLAGS: 00010282
  \[3310.968147\] RAX: 0000000000000026 RBX: ffff973f147b0f60 RCX: 0000000000000027
  \[3310.968149\] RDX: ffff974ecf098a08 RSI: 0000000000000001 RDI: ffff974ecf098a00
  \[3310.968150\] RBP: ffff973f147b0f08 R08: 0000000000000000 R09: ffffb284ce393c48
  \[3310.968151\] R10: ffffb284ce393c40 R11: ffffffff84f47468 R12: ffff973f101bfc00
  \[3310.968153\] R13: ffff971f20cf2000 R14: 00000000fffffff5 R15: ffff973f147b0e58
  \[3310.968154\] FS:  00007efe65468740(0000) GS:ffff974ecf080000(0000) knlGS:0000000000000000
  \[3310.968157\] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  \[3310.968158\] CR2: 000055691bcbe260 CR3: 000000105cfa4001 CR4: 0000000000770ee0
  \[3310.968160\] PKRU: 55555554
  \[3310.968161\] Call Trace:
  \[3310.968167\]  ? dput+0xd4/0x300
  \[3310.968174\]  btrfs\_sync\_file+0x3f1/0x490
  \[3310.968180\]  \_\_x64\_sys\_fsync+0x33/0x60
  \[3310.968185\]  do\_syscall\_64+0x3b/0x90
  \[3310.968190\]  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
  \[3310.968194\] RIP: 0033:0x7efe6557329b
  \[3310.968200\] RSP: 002b:00007ffe0236ebc0 EFLAGS: 00000293 ORIG\_RAX: 000000000000004a
  \[3310.968203\] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007efe6557329b
  \[3310.968204\] RDX: 0000000000000000 RSI: 00007efe58d77010 RDI: 0000000000000006
  \[3310.968205\] RBP: 0000000004000000 R08: 0000000000000000 R09: 00007efe58d77010
  \[3310.968207\] R10: 0000000016cacc0c R11: 0000000000000293 R12: 00007efe5ce95980
  \[3310.968208\] R13: 0000000000000000 R14: 00007efe6447c790 R15: 0000000c80000000
  \[3310.968212\] ---\[ end trace 1a346f4d3c0d96ba \]---
  \[3310.968214\] BTRFS: error (device sda) in cleanup\_transaction:1946: errno=-11 unknown

The abort occurs because of a write hole while writing out freeing tree
nodes of a tree-log tree. For zoned btrfs, we re-dirty a freed tree
node to ensure btrfs can write the region and does not leave a hole on
write on a zoned device. The current code fails to re-dirty a node
when the tree-log tree's depth is greater or equal to 2. That leads to
a transaction abort with -EAGAIN.

Fix the issue by properly re-dirtying a node on walking up the tree.

## Affected and fixed versions

- Linux: \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 477675049ca803aa95ff77468ffbddd966b415b0; \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 84c25448929942edacba905cecc0474e91114e7a (cvelist)
- Linux: 5.12 (cvelist)

## Mitigation

- Upgrade Linux to 84c25448929942edacba905cecc0474e91114e7a or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47510. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47510.md
Affected: Linux >= d3575156f6623eecf086a20bcf99a63f1598109c, < 477675049ca803aa95ff77468ffbddd966b415b0; >= d3575156f6623eecf086a20bcf99a63f1598109c, < 84c25448929942edacba905cecc0474e91114e7a; Linux 5.12
Fixed in: Linux 477675049ca803aa95ff77468ffbddd966b415b0, Linux 84c25448929942edacba905cecc0474e91114e7a

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47510 being exploited?

There is no confirmed exploitation: CVE-2021-47510 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.27% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47510?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47510?

Linux \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 477675049ca803aa95ff77468ffbddd966b415b0; \>= d3575156f6623eecf086a20bcf99a63f1598109c, \< 84c25448929942edacba905cecc0474e91114e7a; Linux 5.12.

### Is there a fix for CVE-2021-47510?

Yes. Fixed in Linux 477675049ca803aa95ff77468ffbddd966b415b0, Linux 84c25448929942edacba905cecc0474e91114e7a. Upgrade Linux to 84c25448929942edacba905cecc0474e91114e7a or later.

### How do I check if I'm affected by CVE-2021-47510?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/477675049ca803aa95ff77468ffbddd966b415b0>
- patch: <https://git.kernel.org/stable/c/84c25448929942edacba905cecc0474e91114e7a>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47510>

HTML: <https://flawdb.com/CVE-2021-47510> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47510>
