Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3055026ybi; Tue, 2 Jul 2019 01:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1WvLmnzQYwGOGA9uqjZ5Tt4aZytvh+ctjunrPlPh6tf64xKXgsXV1AOLqSyAZJ6R88eMI X-Received: by 2002:a63:fb4b:: with SMTP id w11mr29083215pgj.415.1562055293136; Tue, 02 Jul 2019 01:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055293; cv=none; d=google.com; s=arc-20160816; b=NZS7e67k1lfFrJ4DcEUnLfYwRgWoKeo5X/VF0pDxKak8yifKPZPUDfik9IVWEyCTRv YfiKgFayfgBcWaz9z4duhJUUoL02ipyeBH5mWJgmvvTp78//LxES7VXvI2zfwoRr58jN v2Dknrgx/kjjzp30EH7aU/rSovF5Nr5gBESDBLyg6TMY47NJxq/QHBJvjo5B+Edo3j1x lJ+45F/xDayqdPyhPNtsX+BzO5PC/xC6nU6KFcYwfG6MJ/t2pylak1Jg87C9qrEbwvgQ tNFmnehNOVTG6IsmePuFdvg/o1KXDTL7k8rvWghfR4GdnhQPUh1xgVHg1fW6VRoxAz2z cVbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oaH1oxi2DIT1lb36LfUfjQzYFEPi4bmYGdrioAmnJYE=; b=poDfxEHQDdm38iXPr+TwzQkLK1wqCHQFITTQOaTeBabWrJrDjK5v6J0XrA8oGkBNTU FX1p4Ga9WlDhJKFTFNZvKNMDjFF2NdSEcOq8HA0gUl0UjmNLmnGJYAdq0b+A1CHu5kS7 0Ucctzms7g2JY2p2XU2tbrROFBAU9YU0+o9oJZLOwhKy4Y0949yP8grWFTPHuzAvtphJ 8rwoS5yGAs1AgkK6ZAAskZI+zHLammW1BooK32hzW30ZeaiLw8McARK5DgvgnDLrad0l CMhrlVUcCUM+dEEPWNWDN2VzTpzhBbKBOEdelsbEirnyozIhXARWdZseeKIDlZFBw1nF N5hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tnisJnFy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si11647323pgh.408.2019.07.02.01.14.38; Tue, 02 Jul 2019 01:14:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tnisJnFy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727430AbfGBIGf (ORCPT + 99 others); Tue, 2 Jul 2019 04:06:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727772AbfGBIGb (ORCPT ); Tue, 2 Jul 2019 04:06:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB45320659; Tue, 2 Jul 2019 08:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054790; bh=m/YId8kElwAfwvKRqfLdo5gyWdN6jkXg11IKwpYaP70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnisJnFyMZ3mn2JKpDviVg0t0ClFHeAQXmPvXVFoROQRFYYhYWYCxMV7UXj369L2S qvWP8R3kW3ZZIKc3ts1AzuHtaNLF/YRtvIi/kBrRuVtRwfXR9bUi4zKjs1p3sLR3Aj iWtAFqiMXODoTZfJdj5sg3hdrDxMiezWRI6rAtJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naoya Horiguchi , Mike Kravetz , Oscar Salvador , Michal Hocko , Xishi Qiu , "Chen, Jerry T" , "Zhuo, Qiuxu" , Andrew Morton , Linus Torvalds Subject: [PATCH 4.19 36/72] mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails Date: Tue, 2 Jul 2019 10:01:37 +0200 Message-Id: <20190702080126.529253321@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.564652899@linuxfoundation.org> References: <20190702080124.564652899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naoya Horiguchi commit b38e5962f8ed0d2a2b28a887fc2221f7f41db119 upstream. 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/1560154686-18497-2-git-send-email-n-horiguchi@ah.jp.nec.com Signed-off-by: Naoya Horiguchi Fixes: 6bc9b56433b76 ("mm: fix race on soft-offlining") Reviewed-by: Mike Kravetz Reviewed-by: Oscar Salvador Cc: Michal Hocko Cc: Xishi Qiu Cc: "Chen, Jerry T" Cc: "Zhuo, Qiuxu" Cc: [4.19+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1731,6 +1731,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;