]> www.infradead.org Git - users/dwmw2/linux.git/commit
iomap: don't increase i_size if it's not a write operation
authorZhang Yi <yi.zhang@huawei.com>
Wed, 20 Mar 2024 11:05:45 +0000 (19:05 +0800)
committerChristian Brauner <brauner@kernel.org>
Thu, 25 Apr 2024 12:23:54 +0000 (14:23 +0200)
commit943bc0882cebf482422640924062a7daac5a27ba
tree73212f0647e76b73f0a0525d011bee2513134bcc
parent89c6c1d91ab2dc05c6f4ad504b03169aa32694cc
iomap: don't increase i_size if it's not a write operation

Increase i_size in iomap_zero_range() and iomap_unshare_iter() is not
needed, the caller should handle it. Especially, when truncate partial
block, we should not increase i_size beyond the new EOF here. It doesn't
affect xfs and gfs2 now because they set the new file size after zero
out, it doesn't matter that a transient increase in i_size, but it will
affect ext4 because it set file size before truncate. So move the i_size
updating logic to iomap_write_iter().

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://lore.kernel.org/r/20240320110548.2200662-7-yi.zhang@huaweicloud.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c