Skip to content

Commit b38e596

Browse files
Naoya Horiguchitorvalds
authored andcommitted
mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails
The pass/fail of soft offline should be judged by checking whether the raw error page was finally contained or not (i.e. the result of set_hwpoison_free_buddy_page()), but current code do not work like that. It might lead us to misjudge the test result when set_hwpoison_free_buddy_page() fails. Without this fix, there are cases where madvise(MADV_SOFT_OFFLINE) may not offline the original page and will not return an error. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Naoya Horiguchi <[email protected]> Fixes: 6bc9b56 ("mm: fix race on soft-offlining") Reviewed-by: Mike Kravetz <[email protected]> Reviewed-by: Oscar Salvador <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Xishi Qiu <[email protected]> Cc: "Chen, Jerry T" <[email protected]> Cc: "Zhuo, Qiuxu" <[email protected]> Cc: <[email protected]> [4.19+] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 97abc88 commit b38e596

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mm/memory-failure.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,8 @@ static int soft_offline_huge_page(struct page *page, int flags)
17301730
if (!ret) {
17311731
if (set_hwpoison_free_buddy_page(page))
17321732
num_poisoned_pages_inc();
1733+
else
1734+
ret = -EBUSY;
17331735
}
17341736
}
17351737
return ret;

0 commit comments

Comments
 (0)