exfat: fix VDL tracking bugs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest4 patches 6 repliesIn review
- v14 patches 0 repliesSuperseded
Changes in v2 from the cover letter
Rebase onto the latest dev branch.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | exfat: advance valid_size to EOF for append writesfs/ | +8 | 0 replies | |
| 2/4 | exfat: hold the invalidate lock while truncatingfs/ | +4 | 0 replies | |
| 3/4 | exfat: dirty all new pages when extending valid_sizefs/ | +16 | 6 replies | |
| 4/4 | exfat: make valid_size and zeroed_size atomicfs/ fs/ fs/ +2 more | +100 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/4] exfat: fix VDL tracking bugs
From: Chi Zhiling <[email protected]>
exFAT tracks a valid data length (VDL) as exfat_inode_info.valid_size:
below it is valid data, at or above it is a hole that the read paths zero-fill. It is read without the inode lock (->iomap_begin and the buffered-read bio completion) and updated from the write, mmap and truncate paths, so it must only move forward, and only once the data has actually been copied and the folio dirtied. This series fixes the bugs around that invariant:
- An O_APPEND write uses the caller's offset instead of the position recalculated by generic_write_checks(), so valid_size may not be advanced to EOF.
- Truncate does not hold mapping->invalidate_lock, so it can race with an mmap write faulting a page back in for the same range.
- exfat_zero_new_range() does not dirty non-uptodate pages, so some of the zeroed blocks are never written back.
Patch 4 converts valid_size and zeroed_size to monotonic atomic counters as a prerequisite for updating valid_size from contexts that do not hold i_rwsem.
This series was split from:
https://lore.kernel.org/exfat/[email protected]/T/#t
The other patches still need some improvement.
Changes in v2:
Rebase onto the latest dev branch.
Chi Zhiling (4):
exfat: advance valid_size to EOF for append writes
exfat: hold the invalidate lock while truncating
exfat: dirty all new pages when extending valid_size
exfat: make valid_size and zeroed_size atomic
fs/exfat/exfat_fs.h | 60 +++++++++++++++++- fs/exfat/file.c | 144 ++++++++++++++------------------------------ fs/exfat/inode.c | 16 ++--- fs/exfat/iomap.c | 27 ++++----- fs/exfat/namei.c | 4 +- 5 files changed, 127 insertions(+), 124 deletions(-)
Signature · 1 line
2.53.0