Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH v3 0/3] ext4: fix buffered writeback error handling
@ 2026-11-16  6:44 Julian Sun
  2026-11-16  6:44 ` [PATCH v3 1/3] ext4: fix a race between partial writeback and truncation Julian Sun
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Julian Sun @ 2026-11-16  6:44 UTC (permalink / raw)
  To: linux-ext4
  Cc: yi.zhang, jack, tytso, adilger.kernel, libaokun, ojaswin, riteshh

This series fixes error handling and races in ext4 buffer_head writeback.

When the block size is smaller than the folio size, a fatal mapping error
can discard buffers whose mapping has already succeeded, potentially
exposing stale data. On retryable errors, those buffers are submitted,
but cleanup can race with truncation after the partial folio is unlocked
and trigger a BUG_ON by accessing a replacement folio.

Submit the mapped buffers on fatal errors as well, retain the remaining
dirty buffers for later writeback, and record the partial folio's end
before unlocking it so cleanup skips its entire range.

Concurrent updates from writeback and failed-bio completion can also lose
io_end flags. Use atomic bit operations so neither update overwrites the
other.

Sashiko helped identify all three issues addressed by this series.

Changes in v3:
1. Simplify the implementation following Zhang Yi's suggestion.
2. Fix the race between partial folio submission and truncation.

Julian Sun (3):
  ext4: fix a race between partial writeback and truncation
  ext4: submit mapped buffers after fatal mapping errors
  ext4: use atomic bitops for io_end flags

 fs/ext4/inode.c   |   81 +++++++++++++++++++++++++++++++++--------------------
 fs/ext4/ext4.h    |   16 ++++------
 fs/ext4/page-io.c |   20 +++++++------
 3 files changed, 68 insertions(+), 49 deletions(-)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.39.5

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

end of thread, other threads:[~2026-11-16  7:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  6:44 [PATCH v3 0/3] ext4: fix buffered writeback error handling Julian Sun
2026-11-16  6:44 ` [PATCH v3 1/3] ext4: fix a race between partial writeback and truncation Julian Sun
2026-11-16  7:02   ` sashiko-bot
2026-11-16  6:47 ` [PATCH v3 2/3] ext4: submit mapped buffers after fatal mapping errors Julian Sun
2026-11-16  7:24   ` sashiko-bot
2026-11-16  6:47 ` [PATCH v3 3/3] ext4: use atomic bitops for io_end flags Julian Sun
2026-11-16  6:59   ` sashiko-bot

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