← Back to archive

Daily update · Sep 19–20, 2026

Btrfs fixes zoned RAID hang and multiple corruption risks

A batch of Btrfs fixes addresses a zoned-mode allocation hang, device-replace use-after-free, verity cleanup failures, and a statfs compatibility regression.

In brief

This update is a Btrfs-focused bug-fix batch. It resolves a zoned-mode hang for RAID profiles, a use-after-free during device replace, and a regression that created wasteful compressed inline extents. It also improves failure handling for verity cleanup and free space tree rebuilds, and restores stable statfs f_fsid values.

Bug fixes

Fix zone activation check for RAID profiles on zoned devices

btrfs_can_activate_zone() only handled single and DUP profiles. For RAID0/RAID1/RAID1C3/RAID1C4/RAID10, it returned false even with free zones, causing data allocations to fail with -EAGAIN and hang in direct I/O.

Why it matters: Prevents permanent write hangs on zoned Btrfs filesystems using RAID profiles; each profile now requires one active zone per device like single.

3a35e787ac1a

Protect commit-root iteration during device replace

mark_block_group_to_copy() iterated the commit root without holding the commit root semaphore, so a concurrent transaction commit could free extent buffers during iteration.

Why it matters: Avoids a use-after-free crash during device-replace operations.

0594e3423f4b

Stop creating compressed inline extents that don't save space

A recent refactor passed the block size to the compression code, so it no longer rejected compressed data that was not smaller than the original. This could create compressed inline extents that waste metadata space and require decompression on read.

Why it matters: Prevents inefficient inline extents for small files; restores the intended rejection when compression doesn't help.

cc337324cc6b

Handle missing space when rolling back verity items

If enable_verity() failed due to a qgroup limit or ENOSPC, the rollback and orphan cleanup could themselves fail for lack of metadata reservation, forcing the filesystem read-only and leaving unreachable subvolumes. The fix uses the global reserve for these deletion-only transactions.

Why it matters: Prevents forced read-only mounts and unreachable subvolumes after a failed verity setup.

76bf149cd029

Clear free space tree creation flag on rebuild failure

btrfs_rebuild_free_space_tree() set a creation flag and several error paths returned without clearing it. On a live filesystem, the stale flag caused delayed reference processing to be skipped.

Why it matters: Avoids metadata inconsistency after a failed free space tree rebuild; the tree remains marked untrusted so callers fall back to extent-tree caching.

3565893cc72c

Abort transaction when inode update fails during hole punch/reflink

If updating the inode failed after file extent items were dropped or inserted, the transaction was not aborted, so a later commit could leave the filesystem inconsistent.

Why it matters: Prevents persistent metadata corruption after errors during hole punching or reflinking.

97fcd34aa9fd

Validate chunk item size in system chunk array

The superblock validation checked space for a key but not for the chunk item before reading its stripe count, allowing a malformed superblock to trigger an out-of-bounds access.

Why it matters: Hardens superblock validation against corrupted system chunk arrays.

aeab4c628757

Restore device path detection for rootfs without initramfs

A previous lockdep fix broke device path resolution for btrfs root filesystems without initramfs, causing grub-probe to fail. This adds an exception for /dev/root so the boot-time device path is recognized.

Why it matters: Fixes grub-probe and device detection for the minority of users running btrfs rootfs without initramfs.

b797b52e88a6

Derive f_fsid from dev_t only when temp_fsid is active

A previous change mixed dev_t into f_fsid for all single-device filesystems, which changed statfs(2) values across kernel upgrades and reboots. Now the old UUID-based derivation is used unless temp_fsid is active.

Why it matters: Restores stable f_fsid values for normal Btrfs mounts and preserves backward compatibility.

72de4807ba84

Fix misleading tree-checker error messages

Two messages in the tree checker were wrong: one printed the dev extent objectid instead of the offset, and another referred to a free space info item instead of a free space extent item.

Why it matters: Improves diagnostics when corrupted metadata is detected; no functional change.

a1167d942047f59d86d25e41

Source commits11 entries +
3a35e787ac1a

btrfs: zoned: handle RAID profiles in btrfs_can_activate_zone()

Johannes Thumshirn · Aug 24, 2026 · 1 files

0594e3423f4b

btrfs: take commit root semaphore when iterating in mark_block_group_to_copy()

Hongling Zeng · Aug 31, 2026 · 1 files

a1167d942047

btrfs: tree-checker: print dev extent offset in error message

Filipe Manana · Sep 10, 2026 · 1 files

f59d86d25e41

btrfs: tree-checker: fix error message regarding free space extent items

Filipe Manana · Sep 10, 2026 · 1 files

b797b52e88a6

btrfs: add "/dev/root" exception for device path update

Qu Wenruo · Sep 12, 2026 · 1 files

72de4807ba84

btrfs: derive f_fsid with dev_t only when temp_fsid is active

Anand Jain · Sep 12, 2026 · 1 files

cc337324cc6b

btrfs: fix creation of compressed inline extents that don't save space

Filipe Manana · Sep 14, 2026 · 1 files

3565893cc72c

btrfs: clear free space tree creation state on rebuild failure

Guanghui Yang · Sep 16, 2026 · 1 files

76bf149cd029

btrfs: handle lack of space when cleaning up verity items

Daniel Linjama · Sep 16, 2026 · 2 files

97fcd34aa9fd

btrfs: abort transaction on failure to update inode for hole punching and reflinking

Filipe Manana · Sep 16, 2026 · 1 files

aeab4c628757

btrfs: check if there is space for chunk item when validating sys chunk array

Filipe Manana · Sep 16, 2026 · 1 files