Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp599942pxb; Tue, 5 Apr 2022 15:30:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1YcDbkMjMzjdsNLZ3i83obIAm6s4MamXIIIWzzt6uUvsrvyfZHoaHtK+lEgQgV/wlSJsv X-Received: by 2002:a17:90a:ca:b0:1ca:5253:b625 with SMTP id v10-20020a17090a00ca00b001ca5253b625mr6463037pjd.220.1649197830486; Tue, 05 Apr 2022 15:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649197830; cv=none; d=google.com; s=arc-20160816; b=KR8d1bOBstg5X3m8+NVAsQiTbnlMqBv08TdRxR9nWe7Xi33RrCyKqHgQYyD3leyAN0 UFEriIAzjspLsYw6oha4/GHN1BIV/svKlUiSigIE8GMfUfTXjOg8FjdWBF84v684AQ9U igw5pZFEMn4Ewn3ycox5x1m6kMJBYGbMaewKLB6aYjb6whdxeEj4gBFTRjzYcv7kSxuQ lIgobOEdDOHFhLAEyE0VId4ovoMwUP6qdmTOmynx8EFOYHzmNVjPyp/pscqDfkYWITtO /37ldLKJVfjsF8SlIuhO14rlfHInVGumDzXU+3YG0WWJCvpDfdn+pUT7Y7L9UlQATpvl +NRw== 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=hQi2FBmAFRdJM8p8mKAI3t82FphZX2UjAlx85tFlJHqov6lFg9Wv1C+j7AcmVc0r8v KBFNxsph1lmwx6hFUhzvtYNguKcX6+7yt2uT8ClGfrtHZ6oBt1ve3zJcuUeV/VBIfU+R E4FWfP/gYSL2T5gP55H3z4AjPm2JfVnoh6lXiqvMo50yTYK58rkB7rdNHzcpcQZk340W pKu0cs4m7eHNzY47zIoe47tF8qukrZ1EfHYaZVMKjVZNmpMyKEuA/we6c4w3RezbcaOW zWfkt0yKLPEq1Axrgi0Rii3/r+JKzGOZXgF16k4Be7ZD0IR/GpWzjQH85OJEEgZs+lHZ JCGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9684rb4; 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 78-20020a630251000000b003816043ef25si6757936pgc.282.2022.04.05.15.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:30:30 -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=a9684rb4; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34AF414AC9A; Tue, 5 Apr 2022 15:12:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389574AbiDENeA (ORCPT + 99 others); Tue, 5 Apr 2022 09:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346539AbiDEJYR (ORCPT ); Tue, 5 Apr 2022 05:24:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55847DAFE5; Tue, 5 Apr 2022 02:13:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id 01C66B81C15; Tue, 5 Apr 2022 09:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63AE5C385A2; Tue, 5 Apr 2022 09:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150019; bh=ddMf/Q2OYNRAJxNBRf3ZcvSR2v8ceJNOuWDRf7eIQjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9684rb47wAOusW4DfFvYSh3ASdtetgjwsX05Iy5kAie4hhphBlyw/DvR1u8brm2G 6CXV2k/hTDTmEd7jNmjyWqpm9cpZ16HRty35Ae1dmrg2Qw0i1FqUZLpE3U7LCw40hJ ZI0DLnUG/JTFvp0ebrRu3IJ6dr6zanwPI3u3Ncy4= 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.16 0926/1017] XArray: Update the LRU list in xas_split() Date: Tue, 5 Apr 2022 09:30:39 +0200 Message-Id: <20220405070421.703881433@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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