From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Brian Foster <bfoster@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org
Cc: jack@suse.cz, djwong@kernel.org
Subject: Re: [PATCH RFC 1/2] iomap: prioritize iter.status error over ->iomap_end()
Date: Sat, 06 Sep 2025 09:53:46 +0530 [thread overview]
Message-ID: <68bbb79f.170a0220.1880ae.2f12@mx.google.com> (raw)
In-Reply-To: <20250902150755.289469-2-bfoster@redhat.com>
Brian Foster <bfoster@redhat.com> writes:
> Jan Kara reports that commit bc264fea0f6f subtly changed error
> handling behavior in iomap_iter() in the case where both iter.status
> and ->iomap_end() return error codes. Previously, iter.status had
> priority and would return to the caller regardless of the
> ->iomap_end() result. After the change, an ->iomap_end() error
> returns immediately.
>
> This had the unexpected side effect of enabling a DIO fallback to
> buffered write on ext4 because ->iomap_end() could return -ENOTBLK
> and overload an -EINVAL error from the core iomap direct I/O code.
>
> This has been fixed independently in ext4, but nonetheless the
> change in iomap was unintentional. Since other filesystems may use
> this in similar ways, restore long standing behavior and always
> return the value of iter.status if it happens to contain an error
> code.
>
> Fixes: bc264fea0f6f ("iomap: support incremental iomap_iter advances")
> Diagnosed-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
Looks good to me. Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> fs/iomap/iter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/iomap/iter.c b/fs/iomap/iter.c
> index cef77ca0c20b..7cc4599b9c9b 100644
> --- a/fs/iomap/iter.c
> +++ b/fs/iomap/iter.c
> @@ -80,7 +80,7 @@ int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops)
> iomap_length_trim(iter, iter->iter_start_pos,
> olen),
> advanced, iter->flags, &iter->iomap);
> - if (ret < 0 && !advanced)
> + if (ret < 0 && !advanced && !iter->status)
> return ret;
> }
>
> --
> 2.51.0
next prev parent reply other threads:[~2025-09-06 4:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 15:07 [PATCH RFC 0/2] iomap: ->iomap_end() error handling fixes Brian Foster
2025-09-02 15:07 ` [PATCH RFC 1/2] iomap: prioritize iter.status error over ->iomap_end() Brian Foster
2025-09-03 6:09 ` Christoph Hellwig
2025-09-03 11:04 ` Jan Kara
2025-09-06 4:23 ` Ritesh Harjani [this message]
2025-09-02 15:07 ` [PATCH RFC 2/2] iomap: revert the iomap_iter pos on ->iomap_end() error Brian Foster
2025-09-02 21:11 ` Joanne Koong
2025-09-03 12:18 ` Brian Foster
2025-09-03 18:31 ` Joanne Koong
2025-09-03 13:38 ` Jan Kara
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=68bbb79f.170a0220.1880ae.2f12@mx.google.com \
--to=ritesh.list@gmail.com \
--cc=bfoster@redhat.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.