Skip to content

Commit dfe9aa2

Browse files
Wei Yangtorvalds
authored andcommitted
mm/migrate.c: also overwrite error when it is bigger than zero
If we get here after successfully adding page to list, err would be 1 to indicate the page is queued in the list. Current code has two problems: * on success, 0 is not returned * on error, if add_page_for_migratioin() return 1, and the following err1 from do_move_pages_to_node() is set, the err1 is not returned since err is 1 And these behaviors break the user interface. Link: http://lkml.kernel.org/r/[email protected] Fixes: e0153fc ("mm: move_pages: return valid node id in status if the page is already on the target node"). Signed-off-by: Wei Yang <[email protected]> Acked-by: Yang Shi <[email protected]> Cc: John Hubbard <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Michal Hocko <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1f50344 commit dfe9aa2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
16761676
err1 = do_move_pages_to_node(mm, &pagelist, current_node);
16771677
if (!err1)
16781678
err1 = store_status(status, start, current_node, i - start);
1679-
if (!err)
1679+
if (err >= 0)
16801680
err = err1;
16811681
out:
16821682
return err;

0 commit comments

Comments
 (0)