From patchwork Fri Apr 1 02:59:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12797859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3170AC433EF for ; Fri, 1 Apr 2022 02:59:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8121E6B0071; Thu, 31 Mar 2022 22:59:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 79A236B0072; Thu, 31 Mar 2022 22:59:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 613BB6B0073; Thu, 31 Mar 2022 22:59:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 4D1E86B0071 for ; Thu, 31 Mar 2022 22:59:34 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 07D5760B29 for ; Fri, 1 Apr 2022 02:59:24 +0000 (UTC) X-FDA: 79306804248.06.41AFB88 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf13.hostedemail.com (Postfix) with ESMTP id A301A20008 for ; Fri, 1 Apr 2022 02:59:22 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id j13so1301196plj.8 for ; Thu, 31 Mar 2022 19:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jpgRpHXdOgwFJs3Rr/mje+m8UWm4Vip9nY8eSHdbgSU=; b=YE8E18tDAxZzfQ3y/87fqDtCVg3M4Hfk1iGsoXYME+FfcsD/HPIKQDPI1wvT8TGMr7 oTyM9sDo0laBVHOUzFczMe7lNEAPtkMz4JfD2RTCng5Lo6UzPaz2mz/fNWXvY+LuPg3L c0d9JDYw1m5/M2FSptRnBYi6jdqXuu/Ds/sy2aC5AlTQpvJR0oXLZbQ3PI8fSIFRJ+m+ MkCnUcOfaYwtwDmOZsUhwGNSOxbCU4rAwYyyp9ZOENRLaSKP4m/CCTMEa5V3QGlPyPL9 yZv/NLBoCePdnO1a8/rSX8RLne8t3OJSkAMN0dDI1pV9YXEX5UX+JbmtYpRXV+pGJvUg IyPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jpgRpHXdOgwFJs3Rr/mje+m8UWm4Vip9nY8eSHdbgSU=; b=69mQpJswd5hdBpd63+NZZIXd7lDk9Fw2WLr994/YODLVOCaIN0OOIoxXkj2gb3ga1q fLgM/etG7gHyf8mGy6xYP/3icglErJMGdiF9e7h4FFNZGR9LT+8GMQmlzDBHEZM9K6Bt oi2tcq9uR+5QDkAuGiaS/kbHDOEgENERYJUv8eKT8sNmZnp1GkkVyljemqcqbiZ5N/0d e2N/OR0IKYQhGHNcYRKC4lLMiK/01R4Wei+EF+SNsqqLs/0760bMA7YLiZYL2/sdK+7u PvewgbbQSLZ8pYeaz3u7pp0GsstK/WyEUZiB+Fk+dffWLzZC5/P6P7miEsGqSv7ddd1o hFNQ== X-Gm-Message-State: AOAM532cIqqJH4191Gu/BJaZAxTv2hc6wBfN0Wnf10ROtWdu/JMLU+2J 9rYM0t+B/0Od3hwk6FgH/vVDIA== X-Google-Smtp-Source: ABdhPJwmDpT9N4vRu2KbCmzEQRAdDtOMFlcUnp8fyMwkCkz+OLqLDKgoNSCYJ3sa7xBZVWLoobIsjg== X-Received: by 2002:a17:903:1252:b0:154:ca85:59a0 with SMTP id u18-20020a170903125200b00154ca8559a0mr8537629plh.169.1648781959884; Thu, 31 Mar 2022 19:59:19 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.239]) by smtp.gmail.com with ESMTPSA id oo17-20020a17090b1c9100b001bf0ccc59c2sm11566475pjb.16.2022.03.31.19.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 19:59:19 -0700 (PDT) From: Muchun Song To: trond.myklebust@hammerspace.com, anna@kernel.org, akpm@linux-foundation.org Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com, Muchun Song , NeilBrown Subject: [PATCH] NFSv4.2: Fix missing removal of SLAB_ACCOUNT on kmem_cache allocation Date: Fri, 1 Apr 2022 10:59:05 +0800 Message-Id: <20220401025905.49771-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Stat-Signature: mwcmhg5rrawkjuokih33pc7wpcpghzik X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A301A20008 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=YE8E18tD; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf13.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspam-User: X-HE-Tag: 1648781962-180630 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The commit 5c60e89e71f8 ("NFSv4.2: Fix up an invalid combination of memory allocation flags") has stripped GFP_KERNEL_ACCOUNT down to GFP_KERNEL, however, it forgot to remove SLAB_ACCOUNT from kmem_cache allocation. It means that memory is still limited by kmemcg. This patch also fix a NULL pointer reference issue [1] reported by NeilBrown. Link: https://lore.kernel.org/all/164870069595.25542.17292003658915487357@noble.neil.brown.name/ [1] Fixes: 5c60e89e71f8 ("NFSv4.2: Fix up an invalid combination of memory allocation flags") Fixes: 5abc1e37afa0 ("mm: list_lru: allocate list_lru_one only when needed") Reported-by: NeilBrown Signed-off-by: Muchun Song --- fs/nfs/nfs42xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c index ad3405c64b9e..e7b34f7e0614 100644 --- a/fs/nfs/nfs42xattr.c +++ b/fs/nfs/nfs42xattr.c @@ -997,7 +997,7 @@ int __init nfs4_xattr_cache_init(void) nfs4_xattr_cache_cachep = kmem_cache_create("nfs4_xattr_cache_cache", sizeof(struct nfs4_xattr_cache), 0, - (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_ACCOUNT), + (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD), nfs4_xattr_cache_init_once); if (nfs4_xattr_cache_cachep == NULL) return -ENOMEM;