Skip to contentSkip to conversation

mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails

PATCH New [email protected] 1 participant 1 message Jun 28, 2019

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 6/15 mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails

From: Naoya Horiguchi <[email protected]>
Subject: 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.

Fixes 6bc9b56433b76 ("mm: fix race on soft-offlining")
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+]

---

 mm/memory-failure.c |    2 ++
 1 file changed, 2 insertions(+)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails +2 -0
@@ -1730,6 +1730,8 @@ static int soft_offline_huge_page(struct
 		if (!ret) {
 			if (set_hwpoison_free_buddy_page(page))
 				num_poisoned_pages_inc();
+			else
+				ret = -EBUSY;
 		}
 	}
 	return ret;

_