diff mbox series

NFSv4.2: Fix missing removal of SLAB_ACCOUNT on kmem_cache allocation

Message ID 20220401025905.49771-1-songmuchun@bytedance.com (mailing list archive)
State New
Headers show
Series NFSv4.2: Fix missing removal of SLAB_ACCOUNT on kmem_cache allocation | expand

Commit Message

Muchun Song April 1, 2022, 2:59 a.m. UTC
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 <neilb@suse.de>
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 fs/nfs/nfs42xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Muchun Song April 8, 2022, 3:21 p.m. UTC | #1
Ping

Could someone be willing to help merge this?

On Fri, Apr 1, 2022 at 10:59 AM Muchun Song <songmuchun@bytedance.com> wrote:
>
> 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 <neilb@suse.de>
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  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;
> --
> 2.11.0
>
Trond Myklebust April 8, 2022, 3:24 p.m. UTC | #2
On Fri, 2022-04-08 at 23:21 +0800, Muchun Song wrote:
> Ping
> 
> Could someone be willing to help merge this?
> 
It's already in the queue.
Muchun Song April 9, 2022, 1:16 p.m. UTC | #3
On Fri, Apr 8, 2022 at 11:24 PM Trond Myklebust <trondmy@hammerspace.com> wrote:
>
> On Fri, 2022-04-08 at 23:21 +0800, Muchun Song wrote:
> > Ping
> >
> > Could someone be willing to help merge this?
> >
> It's already in the queue.
>

Thanks Trond
diff mbox series

Patch

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;