Skip to content

Commit

Permalink
NFSv4.2: Fix up an invalid combination of memory allocation flags
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trond Myklebust committed Feb 25, 2022
1 parent 9c00fd9 commit 5c60e89
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/nfs/nfs42xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value,
flags = NFS4_XATTR_ENTRY_EXTVAL;
}

buf = kmalloc(alloclen, GFP_KERNEL_ACCOUNT | GFP_NOFS);
buf = kmalloc(alloclen, GFP_KERNEL);
if (buf == NULL)
return NULL;
entry = (struct nfs4_xattr_entry *)buf;
Expand All @@ -213,7 +213,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value,


if (flags & NFS4_XATTR_ENTRY_EXTVAL) {
valp = kvmalloc(len, GFP_KERNEL_ACCOUNT | GFP_NOFS);
valp = kvmalloc(len, GFP_KERNEL);
if (valp == NULL) {
kfree(buf);
return NULL;
Expand Down Expand Up @@ -289,8 +289,7 @@ nfs4_xattr_alloc_cache(void)
{
struct nfs4_xattr_cache *cache;

cache = kmem_cache_alloc(nfs4_xattr_cache_cachep,
GFP_KERNEL_ACCOUNT | GFP_NOFS);
cache = kmem_cache_alloc(nfs4_xattr_cache_cachep, GFP_KERNEL);
if (cache == NULL)
return NULL;

Expand Down

0 comments on commit 5c60e89

Please sign in to comment.