Skip to content

Commit e2c1ab0

Browse files
MiaoheLinakpm00
authored andcommitted
mm: memory-failure: fix unexpected return value in soft_offline_page()
When page_handle_poison() fails to handle the hugepage or free page in retry path, soft_offline_page() will return 0 while -EBUSY is expected in this case. Consequently the user will think soft_offline_page succeeds while it in fact failed. So the user will not try again later in this case. Link: https://lkml.kernel.org/r/[email protected] Fixes: b94e028 ("mm,hwpoison: try to narrow window race for free pages") Signed-off-by: Miaohe Lin <[email protected]> Acked-by: Naoya Horiguchi <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent d59070d commit e2c1ab0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mm/memory-failure.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,10 +2741,13 @@ int soft_offline_page(unsigned long pfn, int flags)
27412741
if (ret > 0) {
27422742
ret = soft_offline_in_use_page(page);
27432743
} else if (ret == 0) {
2744-
if (!page_handle_poison(page, true, false) && try_again) {
2745-
try_again = false;
2746-
flags &= ~MF_COUNT_INCREASED;
2747-
goto retry;
2744+
if (!page_handle_poison(page, true, false)) {
2745+
if (try_again) {
2746+
try_again = false;
2747+
flags &= ~MF_COUNT_INCREASED;
2748+
goto retry;
2749+
}
2750+
ret = -EBUSY;
27482751
}
27492752
}
27502753

0 commit comments

Comments
 (0)