Skip to content

Commit

Permalink
mm, memory_hotplug: __offline_pages fix wrong locking
Browse files Browse the repository at this point in the history
Jan has noticed that we do double unlock on some failure paths when
offlining a page range.  This is indeed the case when
test_pages_in_a_zone respp.  start_isolate_page_range fail.  This was an
omission when forward porting the debugging patch from an older kernel.

Fix the issue by dropping mem_hotplug_done from the failure condition
and keeping the single unlock in the catch all failure path.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 7960509 ("mm, memory_hotplug: print reason for the offlining failure")
Signed-off-by: Michal Hocko <[email protected]>
Reported-by: Jan Kara <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Tested-by: Jan Kara <[email protected]>
Reviewed-by: Oscar Salvador <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Michal Hocko authored and torvalds committed Feb 1, 2019
1 parent 6376360 commit e3df4c6
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
we assume this for now. .*/
if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start,
&valid_end)) {
mem_hotplug_done();
ret = -EINVAL;
reason = "multizone range";
goto failed_removal;
Expand All @@ -1585,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
MIGRATE_MOVABLE,
SKIP_HWPOISON | REPORT_FAILURE);
if (ret) {
mem_hotplug_done();
reason = "failure to isolate range";
goto failed_removal;
}
Expand Down

0 comments on commit e3df4c6

Please sign in to comment.