Linux EXT4 FS development
 help / color / mirror / Atom feed
* [BUG] ext4 -b 1024 -O inline_data: zeros in last page of file after small writes
@ 2026-12-02 14:06 Ulrich Müller
  0 siblings, 0 replies; only message in thread
From: Ulrich Müller @ 2026-12-02 14:06 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Ts'o, Andreas Dilger

[Forwarding Gentoo Linux bug https://bugs.gentoo.org/987733]

On an ext4 FS created with options -b 1024 -O inline_data, files become
corrupted after many small writes to them.

The problem occurs with kernel versions 6.6.38, 6.18.65 and 7.3.7,
as well as on different hardware (Atom x5-Z8350 with eMMC,
AMD Ryzen 7 PRO 7730U with NVME).

The following shell script (run as root because of the loop mount)
reproduces the problem:

-----8<-----
#!/bin/bash
set -e
TMP=$(mktemp -d)
MNT=${TMP}/mnt; mkdir -p "${MNT}"
trap 'umount "${MNT}" 2>/dev/null; rm -rf "${TMP}"' EXIT

truncate -s 16M "${TMP}/fs.img"
mkfs.ext4 -q -F -b 1024 -I 256 -O inline_data "${TMP}/fs.img"

for opt in "" noauto_da_alloc nodelalloc; do
    mount -o "loop,${opt}" "${TMP}/fs.img" "${MNT}"
    for (( i = 0; i < 10000; i++ )); do printf "xxxx\n"; done >"${MNT}/f.txt"
    len=$(stat -c %s "${MNT}/f.txt")
    zeros=$(tr -cd '\0' < "${MNT}/f.txt" | wc -c)
    rm -f "${MNT}/f.txt"
    umount "${MNT}"
    printf "%-20s: %5d bytes, %5d zeros\n" "${opt:-(none)}" "${len}" "${zeros}"
done
----->8-----

Its output here is:

# bash ext4-bug.sh
(none)              : 50000 bytes,   848 zeros
noauto_da_alloc     : 50000 bytes,   848 zeros
nodelalloc          : 50000 bytes,     0 zeros

Expected result: no zeros in either case.

fsck -f on the FS after the test doesn't report any (additional)
problems.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-02 14:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 14:06 [BUG] ext4 -b 1024 -O inline_data: zeros in last page of file after small writes Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox