mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/5] exfat: fix valid_size handling and locking
@ 2026-09-27  8:02 Chi Zhiling
  2026-09-27  8:03 ` [PATCH v1 1/5] exfat: advance valid_size to EOF for append writes Chi Zhiling
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Chi Zhiling @ 2026-09-27  8:02 UTC (permalink / raw)
  To: exfat, linux-kernel
  Cc: Yuezhang.Mo, chenxiaosong, dxdt, hyc.lee, linkinjeon,
	liubaolin12138, sj1557.seo, Chi Zhiling

From: Chi Zhiling <chizhiling@kylinos.cn>

valid_size marks the on-disk up-to-date region of an exFAT file. It is
advanced from the write path, from read/zeroing completion, and via
truncate, while it is read without i_rwsem from ->iomap_begin and from bio
completion context. This series fixes several races and stale-data windows
that follow from that split ownership.

Patches 1-2 are self-contained fixes: an append write may be moved to EOF
by generic_write_checks(), so valid_size must be advanced using the
recalculated position; and exfat_zero_new_range() must mark non-uptodate
pages dirty so the whole page is written back.

Patches 3-4 are prerequisites for patch 5: truncate now holds the
invalidate lock so it is mutually exclusive with mmap writes, and
valid_size/zeroed_size become atomic so they can be read safely outside
i_rwsem. Patch 5 then takes exfat_page_mkwrite() out from under i_rwsem,
since blocking on the inode lock under mmap_lock could deadlock and its
VM_FAULT_RETRY result is not honored, and advances valid_size under the
folio lock to keep the page cache and valid_size consistent.

Link: https://lore.kernel.org/exfat/10029d6f-13cc-4d17-a2f9-b093a8339dde@163.com/T/#t

Chi Zhiling (5):
  exfat: advance valid_size to EOF for append writes
  exfat: dirty all new pages when extending valid_size
  exfat: hold the invalidate lock while truncating
  exfat: make valid_size and zeroed_size atomic
  exfat: use folio lock to protect valid_size

 fs/exfat/exfat_fs.h |  60 ++++++++++++++-
 fs/exfat/file.c     | 183 ++++++++++++++++----------------------------
 fs/exfat/inode.c    |  16 ++--
 fs/exfat/iomap.c    |  36 ++++++---
 fs/exfat/iomap.h    |   1 +
 fs/exfat/namei.c    |   4 +-
 6 files changed, 160 insertions(+), 140 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-09-29 10:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27  8:02 [PATCH v1 0/5] exfat: fix valid_size handling and locking Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 1/5] exfat: advance valid_size to EOF for append writes Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 2/5] exfat: dirty all new pages when extending valid_size Chi Zhiling
2026-09-29 10:26   ` Yuezhang.Mo
2026-09-27  8:03 ` [PATCH v1 3/5] exfat: hold the invalidate lock while truncating Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 4/5] exfat: make valid_size and zeroed_size atomic Chi Zhiling
2026-09-27  8:03 ` [PATCH v1 5/5] exfat: use folio lock to protect valid_size 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®