Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3711684ybv; Mon, 10 Feb 2020 05:08:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwOkktLxSiUQ6oiKjD5YLs9cyQ8j4eUdBseKLrMBGHH4xIJkHQXmlOBnRDujaSPK/wAFFOp X-Received: by 2002:a9d:6184:: with SMTP id g4mr922662otk.223.1581340135091; Mon, 10 Feb 2020 05:08:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581340135; cv=none; d=google.com; s=arc-20160816; b=jFCRRTxJQVem2fEYgqrldlY+As0amTdYgxc25qHIa1l18+BncDkDgJ2IUTVkD4r50X BQFx7zKO89+ZxIr4+jGC9JZCkTFSqrCGOk9Qs/RDgIB7fXmgkrg5gWcHs9I+fQ+6heP6 hl4gAbGr6eq29Qb4CREdeCmsr48LtYQ8QLcREO11NXtsL8EuPu7ZzGXEiA5dkzCtYNvz z0WFg7P/ClnfYiWVgfFs1QOf3OjuBXiKLamwFsHBQLywmamUILhS0yTaXBWMrvmF8oeE QVhTkHTtRmsB+kThSjGngzBdc1evVU028ygbC47Zgpn8FK7UCkHlQl0kAnYGQCATWF55 F4pw== 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=2epkmTrpNaNfdGYJNcAV/YECkMMk02erUbuPCaBz0kM=; b=Wjmnn5VRY2M2/RcQ094Q/K24wcx8HINzzfXC6fGr4btaaS3MEdr6O2I1CzkyyQEVTG ctZ2Ko+iPvRYj0jtvHWkP7fif2zsoHKDXYa3Vv4pHeBsPEjCnuqzthikfiCkry99P22F a41ervLt2RWcsIh81EbrJsZ2DMP72p6udNdJ/gRo4zsxuuUx14rgF1PMZmSlF5ZdqwJi aEE52cGVeixhQYMtaiRUf5ouotHMgocZOws9GwQJVD0cMQeVqFvC4wJXI3z/XbZw8enD mY0DXufjElHZJwIf7VLo38aukhuaaaEDiFgGTOsg3ga3lB/5RMFognjE0bfD4QmpumN7 PASA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hxvWL2c5; 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 r10si156671otk.83.2020.02.10.05.08.43; Mon, 10 Feb 2020 05:08:55 -0800 (PST) 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=hxvWL2c5; 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 S1729652AbgBJNHj (ORCPT + 99 others); Mon, 10 Feb 2020 08:07:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:37934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbgBJMjk (ORCPT ); Mon, 10 Feb 2020 07:39:40 -0500 Received: from localhost (unknown [209.37.97.194]) (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 87DC021739; Mon, 10 Feb 2020 12:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338379; bh=XeZUf+5UvoFoopetZByLEqxrHfZMmM/J/neN3auxS/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxvWL2c5sZlB68Syfgd+1vVsS8rn4/PO0eLYcxZvJSmUHlOO0Vei5wNmP8ZgZxGge P6BfuyZSXl7PDV/jlRlz71q0ZvAn9DDrvOfZkagc8budehrVs+YHMXbGmUW/vc81ry U/Pb0XGbYewBv7wUfxJUTmwwc27UPFWtYgMBADQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yang , Yang Shi , John Hubbard , Vlastimil Babka , Christoph Lameter , Michal Hocko , Andrew Morton , Linus Torvalds Subject: [PATCH 5.5 057/367] mm/migrate.c: also overwrite error when it is bigger than zero Date: Mon, 10 Feb 2020 04:29:30 -0800 Message-Id: <20200210122429.349456433@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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: Wei Yang commit dfe9aa23cab7880a794db9eb2d176c00ed064eb6 upstream. If we get here after successfully adding page to list, err would be 1 to indicate the page is queued in the list. Current code has two problems: * on success, 0 is not returned * on error, if add_page_for_migratioin() return 1, and the following err1 from do_move_pages_to_node() is set, the err1 is not returned since err is 1 And these behaviors break the user interface. Link: http://lkml.kernel.org/r/20200119065753.21694-1-richardw.yang@linux.intel.com Fixes: e0153fc2c760 ("mm: move_pages: return valid node id in status if the page is already on the target node"). Signed-off-by: Wei Yang Acked-by: Yang Shi Cc: John Hubbard Cc: Vlastimil Babka Cc: Christoph Lameter Cc: Michal Hocko Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1676,7 +1676,7 @@ out_flush: err1 = do_move_pages_to_node(mm, &pagelist, current_node); if (!err1) err1 = store_status(status, start, current_node, i - start); - if (!err) + if (err >= 0) err = err1; out: return err;