]> www.infradead.org Git - users/dwmw2/linux.git/commit
iomap: keep on increasing i_size in iomap_write_end()
authorZhang Yi <yi.zhang@huawei.com>
Mon, 3 Jun 2024 11:22:22 +0000 (19:22 +0800)
committerChristian Brauner <brauner@kernel.org>
Wed, 5 Jun 2024 15:23:39 +0000 (17:23 +0200)
commit0841ea4a3b416554be401a91aa267b7de838de8b
treebbefefac8b2269bd651081457fd97486a5b59417
parent3d117494e2a88b9c1e8ad41bbbf2cf453a73620e
iomap: keep on increasing i_size in iomap_write_end()

Commit '943bc0882ceb ("iomap: don't increase i_size if it's not a write
operation")' breaks xfs with realtime device on generic/561, the problem
is when unaligned truncate down a xfs realtime inode with rtextsize > 1
fs block, xfs only zero out the EOF block but doesn't zero out the tail
blocks that aligned to rtextsize, so if we don't increase i_size in
iomap_write_end(), it could expose stale data after we do an append
write beyond the aligned EOF block.

xfs should zero out the tail blocks when truncate down, but before we
finish that, let's fix the issue by just revert the changes in
iomap_write_end().

Fixes: 943bc0882ceb ("iomap: don't increase i_size if it's not a write operation")
Reported-by: Chandan Babu R <chandanbabu@kernel.org>
Link: https://lore.kernel.org/linux-xfs/0b92a215-9d9b-3788-4504-a520778953c2@huaweicloud.com
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://lore.kernel.org/r/20240603112222.2109341-1-yi.zhang@huaweicloud.com
Tested-by: Chandan Babu R <chandanbabu@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c