btrfs: fix beyond-EOF write handling mostly for subpage and larger folios
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs: fix beyond-EOF write handlingfs/ | +4 | 2 replies | |
| 2/2 | btrfs: add an ASSERT() to catch ordered extents without datasumfs/ | +15 | 5 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Filipe Manana |
|---|---|
| 1/2 | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] btrfs: fix beyond-EOF write handling mostly for subpage and larger folios
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(-)
Signature · 1 line
2.52.0