From: Christoph Hellwig <hch@infradead.org>
To: Zhang Yi <yi.zhang@huaweicloud.com>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-ext4@vger.kernel.org, brauner@kernel.org,
djwong@kernel.org, hch@infradead.org, joannelkoong@gmail.com,
yi.zhang@huawei.com, yizhang089@gmail.com,
chengzhihao1@huawei.com, yangerkun@huawei.com, yukuai@fnnas.com
Subject: Re: [PATCH v3 3/5] iomap: fix incorrect did_zero setting in iomap_zero_iter()
Date: Mon, 13 Jul 2026 01:48:15 -0700 [thread overview]
Message-ID: <alSmTw_u7CJV9_D-@infradead.org> (raw)
In-Reply-To: <20260713072906.1726059-4-yi.zhang@huaweicloud.com>
On Mon, Jul 13, 2026 at 03:29:04PM +0800, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
>
> 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.
>
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Can you add a fixes tag?
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2026-07-13 8:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 7:29 [PATCH v3 0/5] iomap: trivial fixes for ext4 conversion Zhang Yi
2026-07-13 7:29 ` [PATCH v3 1/5] iomap: correct the range of a partial dirty clear Zhang Yi
2026-07-13 8:45 ` Christoph Hellwig
2026-07-13 7:29 ` [PATCH v3 2/5] iomap: support invalidating partial folios Zhang Yi
2026-07-13 8:47 ` Christoph Hellwig
2026-07-13 12:29 ` Zhang Yi
2026-07-13 7:29 ` [PATCH v3 3/5] iomap: fix incorrect did_zero setting in iomap_zero_iter() Zhang Yi
2026-07-13 8:48 ` Christoph Hellwig [this message]
2026-07-13 12:30 ` Zhang Yi
2026-07-13 7:29 ` [PATCH v3 4/5] iomap: fix out-of-bounds bitmap_set() with zero-length range Zhang Yi
2026-07-13 8:48 ` Christoph Hellwig
2026-07-13 7:29 ` [PATCH v3 5/5] iomap: add comments for ifs_clear/set_range_dirty() Zhang Yi
2026-07-13 8:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alSmTw_u7CJV9_D-@infradead.org \
--to=hch@infradead.org \
--cc=brauner@kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=djwong@kernel.org \
--cc=joannelkoong@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yi.zhang@huaweicloud.com \
--cc=yizhang089@gmail.com \
--cc=yukuai@fnnas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox