]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
nfsd: more robust allocation failure handling in nfsd_reply_cache_init
authorJeff Layton <jlayton@redhat.com>
Wed, 26 Oct 2016 11:26:40 +0000 (07:26 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 1 Nov 2016 19:47:43 +0000 (15:47 -0400)
commit8f97514b423a0983e4c600099882a9c6613142d2
treeb16f551114bf911b4b5bd914ceedb94434226279
parentf46c445b79906a9da55c13e0a6f6b6a006b892fe
nfsd: more robust allocation failure handling in nfsd_reply_cache_init

Currently, we try to allocate the cache as a single, large chunk, which
can fail if no big chunks of memory are available. We _do_ try to size
it according to the amount of memory in the box, but if the server is
started well after boot time, then the allocation can fail due to memory
fragmentation.

Fall back to doing a vzalloc if the kcalloc fails, and switch the
shutdown code to do a kvfree to handle freeing correctly.

Reported-by: Olaf Hering <olaf@aepfle.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfscache.c