mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/8] exfat: fix valid_size update races
@ 2026-10-16  3:33 Chi Zhiling
  2026-10-16  3:33 ` [PATCH v3 1/8] iomap: export iomap_bio_read_folio_range_sync() Chi Zhiling
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Chi Zhiling @ 2026-10-16  3:33 UTC (permalink / raw)
  To: linux-kernel, linux-xfs, linux-fsdevel, exfat
  Cc: Namjae Jeon, Sungjong Seo, Yuezhang Mo, Christian Brauner,
	Darrick J. Wong, Christoph Hellwig, Chi Zhiling

From: Chi Zhiling <chizhiling@kylinos.cn>

exFAT uses valid_size (ValidDataLength) as the on-disk boundary of
initialised data, but the current code advances it too late or without
proper serialisation.  As a result, buffered writes can silently lose
data reclaimed before valid_size covers it, page faults and direct I/O
can race with writes, and a failed direct write still grows the file
on disk.

This series advances valid_size under the folio lock for buffered
writes, revalidates cached iomaps, drops i_rwsem from
exfat_page_mkwrite(), and publishes i_size/valid_size only on
successful direct I/O completion.

V3:
- Add Fixes: tags to some patches
- Fix two issues since v2 (p2, p6)

V2: https://lore.kernel.org/exfat/20261013033837.2748258-1-chizhiling@163.com/
V1: https://lore.kernel.org/exfat/59056131-e3bd-4003-8c30-0a356cf0bd82@163.com/
Link: https://lore.kernel.org/exfat/10029d6f-13cc-4d17-a2f9-b093a8339dde/T/#t


Chi Zhiling (8):
  iomap: export iomap_bio_read_folio_range_sync()
  exfat: zero the invalid tail of the straddle block under the folio
    lock
  exfat: advance valid_size under the folio lock for buffered writes
  exfat: advance valid_size while zeroing new ranges
  exfat: validate cached iomaps during buffered writes
  exfat: drop i_rwsem from exfat_page_mkwrite
  exfat: complete direct writes synchronously when they update metadata
  exfat: publish i_size and valid_size on direct I/O completion

 fs/exfat/file.c       | 111 +++++++++++++++++----------------
 fs/exfat/inode.c      |   9 +--
 fs/exfat/iomap.c      | 139 +++++++++++++++++++++++++++++++-----------
 fs/exfat/iomap.h      |   1 +
 fs/iomap/bio.c        |   1 +
 fs/iomap/internal.h   |  12 ----
 include/linux/iomap.h |   9 +++
 7 files changed, 176 insertions(+), 106 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-10-16  3:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  3:33 [PATCH v3 0/8] exfat: fix valid_size update races Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 1/8] iomap: export iomap_bio_read_folio_range_sync() Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 2/8] exfat: zero the invalid tail of the straddle block under the folio lock Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 3/8] exfat: advance valid_size under the folio lock for buffered writes Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 4/8] exfat: advance valid_size while zeroing new ranges Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 5/8] exfat: validate cached iomaps during buffered writes Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 6/8] exfat: drop i_rwsem from exfat_page_mkwrite Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 7/8] exfat: complete direct writes synchronously when they update metadata Chi Zhiling
2026-10-16  3:33 ` [PATCH v3 8/8] exfat: publish i_size and valid_size on direct I/O completion Chi Zhiling

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

all inboxes | Powered by JetHome®