From: Brian Foster <bfoster@redhat.com>
To: jianyungao89@gmail.com
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Jan Kara <jack@suse.cz>, Dan Williams <djbw@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
"open list:FILESYSTEM DIRECT ACCESS (DAX)"
<linux-fsdevel@vger.kernel.org>,
"open list:FILESYSTEM DIRECT ACCESS (DAX)"
<nvdimm@lists.linux.dev>
Subject: Re: [PATCH v2] dax: fix wrong error code returned from dax_dedupe_file_range_compare()
Date: Wed, 14 Oct 2026 08:45:33 -0400 [thread overview]
Message-ID: <as95bXy1IfqNUCFo@bfoster> (raw)
In-Reply-To: <20261012144925.6728-1-jianyungao89@gmail.com>
On Mon, Oct 12, 2026 at 10:49:24PM +0800, jianyungao89@gmail.com wrote:
> From: Jianyun Gao <jianyungao89@gmail.com>
>
> When dax_range_compare_iter() returns a negative error code (e.g. -EIO),
> dax_dedupe_file_range_compare() incorrectly returns 'ret' which holds the
> positive return value from iomap_iter() indicating more iterations remain.
> This positive value leaks to the caller, where vfs_dedupe_file_range()
> interprets it as success (bytes_deduped = len), causing userspace to
> incorrectly believe deduplication completed.
>
> Return 'status' instead to propagate the actual error code.
>
> Fixes: 39eb05112987 ("dax: advance the iomap_iter on dedupe range")
Hmm.. the patch looks fine to me, but the above commit basically just
renamed compared to status in this function. I.e. before that commit we
did:
if (compared < 0)
return ret;
... which seems to me has the same problem. So I'm a little curious if
either the Fixes: is wrong, or I'm just missing something..?
Brian
> Cc: stable@vger.kernel.org
> Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
> ---
>
> Changes in v2:
> - Add Fixes tag and Cc stable
> - Add Reviewed-by tag from Jan Kara
>
> v1: Link: https://lore.kernel.org/lkml/20261010021010.19575-1-jianyungao89@gmail.com/
>
> fs/dax.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 6ba50142eeb2..1f6a4fbb97bd 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -2261,7 +2261,7 @@ int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
> status = dax_range_compare_iter(&src_iter, &dst_iter,
> min(src_iter.len, dst_iter.len), same);
> if (status < 0)
> - return ret;
> + return status;
> src_iter.status = dst_iter.status = status;
> }
> return ret;
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-10-14 12:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 14:49 [PATCH v2] dax: fix wrong error code returned from dax_dedupe_file_range_compare() jianyungao89
2026-10-12 15:08 ` sashiko-bot
2026-10-12 16:38 ` Darrick J. Wong
2026-10-14 12:45 ` Brian Foster [this message]
2026-10-15 14:18 ` Jianyun Gao
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=as95bXy1IfqNUCFo@bfoster \
--to=bfoster@redhat.com \
--cc=brauner@kernel.org \
--cc=djbw@kernel.org \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=jianyungao89@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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.