Skip to content

Commit

Permalink
fsdax: dax_unshare_iter() should return a valid length
Browse files Browse the repository at this point in the history
The copy_mc_to_kernel() will return 0 if it executed successfully.  Then
the return value should be set to the length it copied.

[[email protected]: don't mess up `ret', per Matthew]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: d984648 ("fsdax,xfs: port unshare to fsdax")
Signed-off-by: Shiyang Ruan <[email protected]>
Cc: Darrick J. Wong <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
irides authored and akpm00 committed Feb 4, 2023
1 parent aa1e6a9 commit 388bc03
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,9 @@ static s64 dax_unshare_iter(struct iomap_iter *iter)
if (ret < 0)
goto out_unlock;

ret = copy_mc_to_kernel(daddr, saddr, length);
if (ret)
if (copy_mc_to_kernel(daddr, saddr, length) == 0)
ret = length;
else
ret = -EIO;

out_unlock:
Expand Down

0 comments on commit 388bc03

Please sign in to comment.