From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/2] btrfs: fix beyond-EOF write handling mostly for subpage and larger folios
Date: Thu, 11 Dec 2025 12:45:16 +1030 [thread overview]
Message-ID: <cover.1765418669.git.wqu@suse.com> (raw)
Filipe fixed a bug in commit 18de34daa7c6 ("btrfs: truncate ordered
extent when skipping writeback past i_size"), which can lead to btrfs
check reporting missing data checksum.
However that fix is not complete, we can still get file extents inserted
without any data checksum.
The root cause is that the original beyond-EOF handling is not compatible
with subpage/larger folios from day 1, thus as long as we're still using
the old [cur, end) range, there will always be something incorrect.
The old handling is always handling the range [cur, end), which at that
time can only be one fs block.
Later subpage support is still re-using that part, but the enhanced
btrfs_folio_clear_dirty() function allows passing a range that covers
non-dirty blocks, this enhanced behavior masked the problem.
The true fix to the beyond-EOF handling should handle each beyond-EOF
block one-by-one, just like how we handle regular writes.
The first patch is the minimal fix that can be backported, but
unfortunately that still relies on the commit 18de34daa7c6 ("btrfs: truncate
ordered extent when skipping writeback past i_size") itself, and can be
tricky for older branches.
The second patch is to add an extra ASSERT() to catch any OE extent that
doesn't have a proper reason to have no data checksum.
With that new ASSERT() we can catch missing cases more reliably.
Qu Wenruo (2):
btrfs: fix beyond-EOF write handling
btrfs: add an ASSERT() to catch ordered extents without datasum
fs/btrfs/extent_io.c | 8 ++++----
fs/btrfs/inode.c | 15 +++++++++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
--
2.52.0
next reply other threads:[~2025-12-11 2:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 2:15 Qu Wenruo [this message]
2025-12-11 2:15 ` [PATCH 1/2] btrfs: fix beyond-EOF write handling Qu Wenruo
2025-12-11 11:26 ` Filipe Manana
2025-12-11 23:05 ` Qu Wenruo
2025-12-11 2:15 ` [PATCH 2/2] btrfs: add an ASSERT() to catch ordered extents without datasum Qu Wenruo
2025-12-11 11:41 ` Filipe Manana
2025-12-11 16:06 ` Filipe Manana
2025-12-11 23:15 ` Qu Wenruo
2025-12-12 3:15 ` Qu Wenruo
2025-12-11 23:06 ` Qu Wenruo
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=cover.1765418669.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox