diff options
| author | Zhang Yi <yi.zhang@huawei.com> | 2026-07-14 16:23:23 +0800 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-07-23 11:26:28 +0200 |
| commit | 7a6fd6b21d7e1737b40de1a210acf9e6a1e4d59e (patch) | |
| tree | 24d2a206ad8ab0afa2f32fb6554e884172286c5b /rust/zerocopy-derive/git@git.tavy.me:linux.git | |
| parent | 562d192c43459d70d955775e8a17eebd995539d4 (diff) | |
iomap: fix incorrect did_zero setting in iomap_zero_iter()
The did_zero output parameter was unconditionally set after the loop,
which is incorrect. It should only be set when the zeroing operation
actually completes, not when IOMAP_F_STALE is set or when
IOMAP_F_FOLIO_BATCH is set but !folio causes the loop to break early,
or when iomap_iter_advance() returns an error.
This causes did_zero to be incorrectly set when zeroing a clean
unwritten extent because the loop exits early without actually zeroing
any data.
Fix it by using a local variable to track whether any folio was actually
zeroed, and only set did_zero after the loop if zeroing happened.
Fixes: 98eb8d95025b ("iomap: set did_zero to true when zeroing successfully")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20260714082325.325163-4-yi.zhang@huaweicloud.com
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'rust/zerocopy-derive/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
