Re: [PATCH v3] ext4: do not advance i_size on a buffered write that copied nothing
From: Theodore Ts'o
Date: Thu Nov 19 2026 - 09:51:11 EST
On Fri, 30 Oct 2026 00:05:20 -0400, Hengyu Liang wrote:
> Commit 665575cff098 ("filemap: move prefaulting out of hot write path")
> made generic_perform_write() call ->write_begin() and ->write_end()
> before it finds out that the source buffer cannot be read. In that
> case ->write_end() is called with copied == 0.
>
> However, ext4_write_end(), ext4_journalled_write_end() and
> ext4_da_do_write_end() set i_size to pos + copied without checking
> copied. As of now, a buffered write() past EOF that fails with EFAULT
> grows the file to the write offset, and the new size can reach the
> disk.
>
> [...]
Applied, thanks!
[1/1] ext4: do not advance i_size on a buffered write that copied nothing
commit: 66998b3184cdfcb7fa0f28deb4c0c6ea1236b501
Best regards,
--
Theodore Ts'o <tytso@xxxxxxx>