From: "Ulrich Müller" <ulm@gentoo.org>
To: linux-ext4@vger.kernel.org
Cc: "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>
Subject: [BUG] ext4 -b 1024 -O inline_data: zeros in last page of file after small writes
Date: Wed, 02 Dec 2026 15:06:56 +0100 [thread overview]
Message-ID: <ucxrjwzcv@gentoo.org> (raw)
[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.
reply other threads:[~2026-12-02 14:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ucxrjwzcv@gentoo.org \
--to=ulm@gentoo.org \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.