Skip to content

btrfs: dio partial write corruption fix

Boris Burkov linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 12 repliesIn review

Changes in v2 from the cover letter

- rename new ordered extent function
- pull the new function into a prep patch
- reorganize how the ordered_extent is stored/passed around to avoid so many annoying memsets and exposing it to fs/btrfs/file.c
- lots of small code style improvements
- remove unintentional whitespace changes
- commit message improvements
- various ASSERTs for clarity/debugging

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: btrfs_alloc_ordered_extentfs/btrfs/ordered-data.c fs/btrfs/ordered-data.h+42 -102 replies
2/2btrfs: fix dio continue after short write due to buffer page faultfs/btrfs/btrfs_inode.h fs/btrfs/file.c fs/btrfs/inode.c+67 -209 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchFilipe MananaChristoph Hellwig
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: dio partial write corruption fix

If there is a page fault while btrfs reads the write buffer for a dio write, then iomap will issue a partial bio which ultimately results in an effective hole in the btrfs representation of the file. If what was being written was not zeros, this means incorrect file contents.

The patch series consists of a prep patch creating a new ordered extent allocation function and the business patch, which contains the fix as well as the gory details of the bug itself.

---
Changelog:
v2:
- rename new ordered extent function
- pull the new function into a prep patch
- reorganize how the ordered_extent is stored/passed around to avoid so many annoying memsets and exposing it to fs/btrfs/file.c
- lots of small code style improvements
- remove unintentional whitespace changes
- commit message improvements
- various ASSERTs for clarity/debugging

Boris Burkov (2):
btrfs: btrfs_alloc_ordered_extent
btrfs: fix dio continue after short write due to buffer page fault

 fs/btrfs/btrfs_inode.h  |  1 +
 fs/btrfs/file.c         | 11 +++++-
 fs/btrfs/inode.c        | 75 ++++++++++++++++++++++++++++++-----------
 fs/btrfs/ordered-data.c | 45 ++++++++++++++++++++-----
 fs/btrfs/ordered-data.h |  7 +++-
 5 files changed, 109 insertions(+), 30 deletions(-)
Signature · 1 line
2.38.1