Re: [PATCH v2] exfat: mark straddling folio RO and zero the post-EOF range
From: Namjae Jeon
Date: Fri Oct 09 2026 - 10:18:32 EST
On Fri, Oct 9, 2026 at 6:31 PM Yuezhang Mo <Yuezhang.Mo@xxxxxxxx> wrote:
>
> When extending a file across a non-page-aligned EOF, the folio
> containing the old EOF must be marked RO so that subsequent mmap
> writes trigger ->page_mkwrite() and update valid_size.
>
> The straddling folio remains mapped to the same filesystem block
> after the file is extended. As a result, the existing writable PTE
> may remain in place, allowing mmap writes to bypass ->page_mkwrite()
> and leave valid_size unchanged.
>
> Furthermore, writes to the post-EOF range may occur between
> truncate_pagecache() and locking the folio, so the post-EOF range
> should be zeroed after marking the straddling folio RO.
>
> Introduce exfat_pagecache_isize_extended() to mark the straddling
> folio RO and zero the post-EOF range after clearing writable mapping.
> This ensures that data written beyond the old EOF before the extension
> is not exposed as valid file data, and that subsequent mmap writes
> trigger ->page_mkwrite() to update valid_size.
>
> Fixes: 82a81a7352bc ("exfat: add iomap buffered I/O support")
> Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
There are still review comments on sashiko. Please check them.
https://sashiko.dev/#/patchset/20261009093020.1018892-3-Yuezhang.Mo%40sony.com
Thanks.