mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
nfsd: more robust allocation failure handling in nfsd_file_cache_init
The nfsd file cache table can be pretty large and its allocation may require as many as 80 contigious pages. Employ the same fix that was employed for similar issue that was reported for the reply cache hash table allocation several years ago by commit 8f97514b423a ("nfsd: more robust allocation failure handling in nfsd_reply_cache_init"). Fixes: 65294c1f2c5e ("nfsd: add a new struct file caching facility to nfsd") Link: https://lore.kernel.org/linux-nfs/e3cdaeec85a6cfec980e87fc294327c0381c1778.camel@kernel.org/ Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Amir Goldstein <amir73il@gmail.com>
This commit is contained in:
parent
74aaf96fea
commit
4d2eeafecd
@ -632,7 +632,7 @@ nfsd_file_cache_init(void)
|
|||||||
if (!nfsd_filecache_wq)
|
if (!nfsd_filecache_wq)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
nfsd_file_hashtbl = kcalloc(NFSD_FILE_HASH_SIZE,
|
nfsd_file_hashtbl = kvcalloc(NFSD_FILE_HASH_SIZE,
|
||||||
sizeof(*nfsd_file_hashtbl), GFP_KERNEL);
|
sizeof(*nfsd_file_hashtbl), GFP_KERNEL);
|
||||||
if (!nfsd_file_hashtbl) {
|
if (!nfsd_file_hashtbl) {
|
||||||
pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n");
|
pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n");
|
||||||
@ -700,7 +700,7 @@ out_err:
|
|||||||
nfsd_file_slab = NULL;
|
nfsd_file_slab = NULL;
|
||||||
kmem_cache_destroy(nfsd_file_mark_slab);
|
kmem_cache_destroy(nfsd_file_mark_slab);
|
||||||
nfsd_file_mark_slab = NULL;
|
nfsd_file_mark_slab = NULL;
|
||||||
kfree(nfsd_file_hashtbl);
|
kvfree(nfsd_file_hashtbl);
|
||||||
nfsd_file_hashtbl = NULL;
|
nfsd_file_hashtbl = NULL;
|
||||||
destroy_workqueue(nfsd_filecache_wq);
|
destroy_workqueue(nfsd_filecache_wq);
|
||||||
nfsd_filecache_wq = NULL;
|
nfsd_filecache_wq = NULL;
|
||||||
@ -811,7 +811,7 @@ nfsd_file_cache_shutdown(void)
|
|||||||
fsnotify_wait_marks_destroyed();
|
fsnotify_wait_marks_destroyed();
|
||||||
kmem_cache_destroy(nfsd_file_mark_slab);
|
kmem_cache_destroy(nfsd_file_mark_slab);
|
||||||
nfsd_file_mark_slab = NULL;
|
nfsd_file_mark_slab = NULL;
|
||||||
kfree(nfsd_file_hashtbl);
|
kvfree(nfsd_file_hashtbl);
|
||||||
nfsd_file_hashtbl = NULL;
|
nfsd_file_hashtbl = NULL;
|
||||||
destroy_workqueue(nfsd_filecache_wq);
|
destroy_workqueue(nfsd_filecache_wq);
|
||||||
nfsd_filecache_wq = NULL;
|
nfsd_filecache_wq = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user