Skip to content

Commit 388bc03

Browse files
iridesakpm00
authored andcommitted
fsdax: dax_unshare_iter() should return a valid length
The copy_mc_to_kernel() will return 0 if it executed successfully. Then the return value should be set to the length it copied. [akpm@linux-foundation.org: don't mess up `ret', per Matthew] Link: https://lkml.kernel.org/r/1675341227-14-1-git-send-email-ruansy.fnst@fujitsu.com Fixes: d984648 ("fsdax,xfs: port unshare to fsdax") Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com> Cc: Darrick J. Wong <djwong@kernel.org> Cc: Alistair Popple <apopple@nvidia.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent aa1e6a9 commit 388bc03

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/dax.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,9 @@ static s64 dax_unshare_iter(struct iomap_iter *iter)
12711271
if (ret < 0)
12721272
goto out_unlock;
12731273

1274-
ret = copy_mc_to_kernel(daddr, saddr, length);
1275-
if (ret)
1274+
if (copy_mc_to_kernel(daddr, saddr, length) == 0)
1275+
ret = length;
1276+
else
12761277
ret = -EIO;
12771278

12781279
out_unlock:

0 commit comments

Comments
 (0)