Re: [PATCH v3] dax: fix wrong error code returned from dax_dedupe_file_range_compare()
From: Alison Schofield
Date: Mon Oct 19 2026 - 14:11:49 EST
On Thu, Oct 15, 2026 at 10:34:25PM +0800, jianyungao89@xxxxxxxxx wrote:
> From: Jianyun Gao <jianyungao89@xxxxxxxxx>
>
> 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: 0e79e3736d54 ("fsdax: dedupe: iter two files at the same time")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Jianyun Gao <jianyungao89@xxxxxxxxx>
> Reviewed-by: Jan Kara <jack@xxxxxxx>
> Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
Applied to libnvdimm-for-next:
https://git.kernel.org/nvdimm/nvdimm/c/9b036546a02c