Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3057265ybi; Tue, 2 Jul 2019 01:17:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdN0Yd0gIcqTwOP6OS9aIrU8wFDjWy8JhXsVCeDLIOX3IvSJIFzYh9/A8lPTTzWzvcb9K4 X-Received: by 2002:a65:640d:: with SMTP id a13mr19995569pgv.256.1562055467817; Tue, 02 Jul 2019 01:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055467; cv=none; d=google.com; s=arc-20160816; b=XFPGjo/aq0At0H5qsYXvhC0iDEtHu0tE+4WcfnxS6+xNZ6ZF1w5pq6oPUh9XCySk6L 99QS7l9WmQVEuqZjBh+CDPyae8TyFjVsW4ltx0W0upHUC9xACZ9mkjLG/1a0BkGWadsS gz+OcXvMHNs0mv3d7ZEneZqadAwT4Wga84PMx2WWfmMfgPIQlU3HR4rQLvncyoitiNIA lHpgMgEM8Bc7VWNU9UhB8S/CrbekQkBW4i8mzyw/6t4V1hZ65dKidCLeBpS0bWhvupOv Al+zto6d9mV93Ld3nMOJ5wffog+NUnx5NwPWWyM/j2UhLr5dG28z7006IKYn10UlHFE5 1rdg== 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=Aqb2CrmCEddYG8Up3VHA7SvP38u6WRpADOOlez9spVg=; b=sxImGxwOC5ZLYqkGAmBlPDp/oXlFJO7iK2HYCzg+zndKOzRyTsztIsHNt6KCqCqKHn CEqjaFy1Q262GRJ6pXyCAUic4IdaKrVBwFmzSJZEL6/YJa1HYNm2jjHoiWbxuq8FU7lh PFwVKS2yuIRTNbT5mC0nQOhPif66efnoHOUnbGXJ1wlix8XRPYXQuyg0sZGQ4+7rpdyG 1jazHRBJpi901SLQDNXncnFWz/DM743dNpCnP+rqO0qzDVwHh7U4then4Th6LExO1WoH zcnXvEGfTmjHEl1hGmqZEeiHB03fYpiCKth7Pv2532e42OgHFEXpGCsrRb6z90OfzdyY n0Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dIDgWmeZ; 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 s33si10403994pgk.112.2019.07.02.01.17.33; Tue, 02 Jul 2019 01:17:47 -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=dIDgWmeZ; 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 S1727153AbfGBICr (ORCPT + 99 others); Tue, 2 Jul 2019 04:02:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:47422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727088AbfGBICq (ORCPT ); Tue, 2 Jul 2019 04:02:46 -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 BA4D3216C8; Tue, 2 Jul 2019 08:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054565; bh=l38vMRgwQYIAowAjhEHFO5/jEsKo8inoBgrQgGayZSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIDgWmeZ50eXlgPbMSBheKChSI4rUCkOwRu6UThSXnw8Icmy1DCgYG4afIEnIC6Ll rLEZYgECQtvMnkvtlE83nbAPkFWQbJerhP64nJIyRoccgQ7RMZ1mKiJLg4W6bL6yzj oAcRZatYE+jLw7wSMI/4VqwUvXO6FYdOcs5u8seQ= 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 5.1 13/55] mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails Date: Tue, 2 Jul 2019 10:01:21 +0200 Message-Id: <20190702080124.727361433@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.103022729@linuxfoundation.org> References: <20190702080124.103022729@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 @@ -1733,6 +1733,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;