Re: [PATCH v5 1/2] dax: return the comparison error from dax_dedupe_file_range_compare()
From: Darrick J. Wong
Date: Sun Sep 27 2026 - 11:01:36 EST
On Sat, Sep 26, 2026 at 12:38:35PM +0800, Matthias Goergens wrote:
> dax_dedupe_file_range_compare() returns ret, the positive result of the
> last iomap_iter() call, when dax_range_compare_iter() fails. The caller
> treats any non-zero return as the result of the range preparation, and
> xfs_file_remap_range() returns it as the remap result, so a failed
> comparison on a DAX file reports success with a small positive length
> instead of the error.
>
> Return the error itself.
>
> Fixes: 0e79e3736d54 ("fsdax: dedupe: iter two files at the same time")
> Signed-off-by: Matthias Goergens <matthias.goergens@xxxxxxxxx>
That seems like a bug, I'm sorta surprised nobody noticed...
Cc: <stable@xxxxxxxxxxxxxxx> # v6.2
Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
--D
> ---
> fs/dax.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 1fbba0d21c13..de11bbbb6a38 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -2264,7 +2264,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.55.0
>
>