Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp849584pxb; Wed, 6 Apr 2022 01:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoPCzYAHgq3NLnU+juoyTphbz/UGVRTAnaFWjEs6g5/H4z4ZX4EkhopxNyHViUzt895e0l X-Received: by 2002:a63:1847:0:b0:381:8214:3a7d with SMTP id 7-20020a631847000000b0038182143a7dmr6110804pgy.134.1649235180631; Wed, 06 Apr 2022 01:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649235180; cv=none; d=google.com; s=arc-20160816; b=FHxxow7s4a6MkfHGvh14+ToyGz68Ac4R5XSK6sBANw4kFf+JrqKObrlYMXGNcdfBuL FNeYB3fBn/d95OLR3SYBAZikJ8PE26AV99G4P2NhgoLKQjxlF39AWnheMYXATxtmQhjD iSQ0dT8aeb5g00nBRaiZv9sENzCjh0AvoX1uu9OD5/pWUczE+Zn1y1j0MRN7eCaourDl kFMLQ6YXo6NOF1UJtRCTmu4QOZyj9x4oqS7eWhbzDl+lPPXHPjBAnJnutepI4rsoF23G 0nGhNg1tgcGXQn80B38LxjPdFnpBi+wsgCwSOtMrR5Cizb5cU2cSEe5Al7SWA3Xii9P4 06lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4uQsGvPss7GRho8MtOK42sJ6laeYvj9xvAoDXJmzcag=; b=OWLYmXHhYgM7kykkNexPza5riB2G/BEcmU2n6KAPQ1aruXWxHRgiiNCN/ayW8+uT7F Xa9HRKsYqwFGvSMwdUwY/GRr802ZowS2XwzR4VYL/QAfzDawLMFAc0q8ut//Vc10XMYU qGxoGirTE94KbcmXwKGe44NHxfoFCb3bGzQY2/M1wBchwggyUnNMICUoXeXSVzc6jrx2 8f2+oLHp+kvJStYywCwpT5/NPGedUGo9DtGDBFT2W/CKJ9R5X5jItdsXq6w7/Me9KSq1 Pi3bNAowPfVoOmBGx0yMHx4GsshTFKCOJEn4zPzCJPJst+O5eESPanqLdo/5tDYrDIKU D1Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iTnc6SzY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mq9-20020a17090b380900b001c6c499d30csi4940501pjb.162.2022.04.06.01.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 01:53:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iTnc6SzY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5E2359B5D6; Wed, 6 Apr 2022 01:38:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1583507AbiDEXxD (ORCPT + 99 others); Tue, 5 Apr 2022 19:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354018AbiDEKKs (ORCPT ); Tue, 5 Apr 2022 06:10:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F21E04F443; Tue, 5 Apr 2022 02:56:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 49E49CE1C6C; Tue, 5 Apr 2022 09:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 616F6C385A3; Tue, 5 Apr 2022 09:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152597; bh=ddMf/Q2OYNRAJxNBRf3ZcvSR2v8ceJNOuWDRf7eIQjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTnc6SzYNdai+QAmdWC4u8lN2ex6qLtx++U/nZKkXgtor9+jWe2uTJDqlzO+x5FcL GidiEL90btim7thYXKxTz6ZireQFK2MMMbYVJDk2ahbrEdeFKWwd0BpV9jYh3ScnHh +39PB56n3pyBAEnu9yX3nxNfTQxROLCgDt11/GPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins , "Matthew Wilcox (Oracle)" Subject: [PATCH 5.15 835/913] XArray: Update the LRU list in xas_split() Date: Tue, 5 Apr 2022 09:31:37 +0200 Message-Id: <20220405070404.859282803@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox (Oracle) commit 3ed4bb77156da0bc732847c8c9df92454c1fbeea upstream. When splitting a value entry, we may need to add the new nodes to the LRU list and remove the parent node from the LRU list. The WARN_ON checks in shadow_lru_isolate() catch this oversight. This bug was latent until we stopped splitting folios in shrink_page_list() with commit 820c4e2e6f51 ("mm/vmscan: Free non-shmem folios without splitting them"). That allows the creation of large shadow entries, and subsequently when trying to page in a small page, we will split the large shadow entry in __filemap_add_folio(). Fixes: 8fc75643c5e1 ("XArray: add xas_split") Reported-by: Hugh Dickins Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Greg Kroah-Hartman --- lib/xarray.c | 2 ++ 1 file changed, 2 insertions(+) --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1081,6 +1081,7 @@ void xas_split(struct xa_state *xas, voi xa_mk_node(child)); if (xa_is_value(curr)) values--; + xas_update(xas, child); } else { unsigned int canon = offset - xas->xa_sibs; @@ -1095,6 +1096,7 @@ void xas_split(struct xa_state *xas, voi } while (offset-- > xas->xa_offset); node->nr_values += values; + xas_update(xas, node); } EXPORT_SYMBOL_GPL(xas_split); #endif