public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: fix beyond-EOF write handling mostly for subpage and larger folios
@ 2025-12-11  2:15 Qu Wenruo
  2025-12-11  2:15 ` [PATCH 1/2] btrfs: fix beyond-EOF write handling Qu Wenruo
  2025-12-11  2:15 ` [PATCH 2/2] btrfs: add an ASSERT() to catch ordered extents without datasum Qu Wenruo
  0 siblings, 2 replies; 10+ messages in thread
From: Qu Wenruo @ 2025-12-11  2:15 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-12-12  3:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-11  2:15 [PATCH 0/2] btrfs: fix beyond-EOF write handling mostly for subpage and larger folios Qu Wenruo
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

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