Re: [PATCH v2 0/7] exfat: fix valid_size update races
From: Chi Zhiling
Date: Tue Oct 13 2026 - 02:04:43 EST
On 10/13/2026 12:04 PM, Namjae Jeon wrote:
On Tue, Oct 13, 2026 at 12:39 PM Chi Zhiling <chizhiling@xxxxxxx> wrote:
Hi Chi,
From: Chi Zhiling <chizhiling@xxxxxxxxxx>
Hi Namjae,
Can you add fixes tags to the patches ?
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.
V1: https://lore.kernel.org/exfat/59056131-e3bd-4003-8c30-0a356cf0bd82@xxxxxxx/
Link: https://lore.kernel.org/exfat/10029d6f-13cc-4d17-a2f9-b093a8339dde/T/#t
Chi Zhiling (7):
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: do not re-zero the valid range in exfat_page_mkwrite
exfat: complete direct writes synchronously when they update metadata
exfat: publish i_size and valid_size on direct I/O completion
Sure, I'll add Fixes tag in the next version.