NFSv4.2: Fix up an invalid combination of memory allocation flags

We should use either GFP_KERNEL or GFP_NOFS, but not both. Also strip
GFP_KERNEL_ACCOUNT down to GFP_KERNEL. This memory is shrinkable, so
does not need to be limited by kmemcg.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Trond Myklebust 2022-01-29 14:03:06 -05:00
parent 9c00fd9acb
commit 5c60e89e71

View File

@ -199,7 +199,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value,
flags = NFS4_XATTR_ENTRY_EXTVAL; flags = NFS4_XATTR_ENTRY_EXTVAL;
} }
buf = kmalloc(alloclen, GFP_KERNEL_ACCOUNT | GFP_NOFS); buf = kmalloc(alloclen, GFP_KERNEL);
if (buf == NULL) if (buf == NULL)
return NULL; return NULL;
entry = (struct nfs4_xattr_entry *)buf; entry = (struct nfs4_xattr_entry *)buf;
@ -213,7 +213,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value,
if (flags & NFS4_XATTR_ENTRY_EXTVAL) { if (flags & NFS4_XATTR_ENTRY_EXTVAL) {
valp = kvmalloc(len, GFP_KERNEL_ACCOUNT | GFP_NOFS); valp = kvmalloc(len, GFP_KERNEL);
if (valp == NULL) { if (valp == NULL) {
kfree(buf); kfree(buf);
return NULL; return NULL;
@ -289,8 +289,7 @@ nfs4_xattr_alloc_cache(void)
{ {
struct nfs4_xattr_cache *cache; struct nfs4_xattr_cache *cache;
cache = kmem_cache_alloc(nfs4_xattr_cache_cachep, cache = kmem_cache_alloc(nfs4_xattr_cache_cachep, GFP_KERNEL);
GFP_KERNEL_ACCOUNT | GFP_NOFS);
if (cache == NULL) if (cache == NULL)
return NULL; return NULL;