Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: don't lose fsynced data to a transaction abort
@ 2026-12-03 23:56 Leo Martins
  2026-12-03 23:56 ` [PATCH v2 1/2] btrfs: fix loss of fsynced data when ordered extent completion fails Leo Martins
  2026-12-03 23:56 ` [PATCH v2 2/2] btrfs: refuse NOCOW writes after a filesystem error Leo Martins
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Martins @ 2026-12-03 23:56 UTC (permalink / raw)
  To: linux-btrfs, kernel-team
  Cc: David Sterba, Chris Mason, Filipe Manana, Josef Bacik

Fast fsync can sync a file extent item and its checksums to the tree
log while the ordered extent is still waiting to update the subvolume
tree. If the transaction aborts in between, replay can restore a file
mapping whose blocks were overwritten after fsync returned.

If an ordered extent that fast fsync logged fails to complete, patch 1
preserves the log for replay, and for a COW write keeps the new blocks
out of the free space cache. Patch 2 refuses NOCOW writes after a
filesystem error, so they can't overwrite logged data in place. That
covers a preallocated range the failed ordered extent left unwritten,
and an extent shared by a reflink that the cross-ref check can no longer
see after an abort.

The series is based on for-next, which has Josef's "btrfs: data
integrity fixes" v3 [1]. Patch 1 describes the fast fsync prerequisites.

Changes in v2:
- Also handle failed writes into prealloc extents (Sashiko, via
  Filipe) and NOCOW writes in patch 1.
- Check IOERR before marking an extent logged if ordered extent
  completion races fsync.
- New patch 2.
- Fix the discard comment (Filipe).

v1: https://lore.kernel.org/linux-btrfs/54da67463c57f41302f8456a8a7a1190dcb65ae2.1794266796.git.loemra.dev@gmail.com/

[1] https://lore.kernel.org/linux-btrfs/20261120-b4-btrfs-data-integrity-v3-0-4de4b91b826e@toxicpanda.com/

Leo Martins (2):
  btrfs: fix loss of fsynced data when ordered extent completion fails
  btrfs: refuse NOCOW writes after a filesystem error

 fs/btrfs/inode.c    | 100 +++++++++++++++++++++++++++++++++++++-------
 fs/btrfs/tree-log.c |  26 ++++++++----
 2 files changed, 104 insertions(+), 22 deletions(-)


base-commit: 418f7723b545cf064fc584529710b28d1347188e
-- 
2.53.1-Meta


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

end of thread, other threads:[~2026-12-04 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 23:56 [PATCH v2 0/2] btrfs: don't lose fsynced data to a transaction abort Leo Martins
2026-12-03 23:56 ` [PATCH v2 1/2] btrfs: fix loss of fsynced data when ordered extent completion fails Leo Martins
2026-12-04 11:50   ` Filipe Manana
2026-12-03 23:56 ` [PATCH v2 2/2] btrfs: refuse NOCOW writes after a filesystem error Leo Martins
2026-12-04 11:51   ` Filipe Manana

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