Skip to content

Commit 4d2eeaf

Browse files
amir73ilchucklever
authored andcommitted
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 8f97514 ("nfsd: more robust allocation failure handling in nfsd_reply_cache_init"). Fixes: 65294c1 ("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>
1 parent 74aaf96 commit 4d2eeaf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/nfsd/filecache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ nfsd_file_cache_init(void)
632632
if (!nfsd_filecache_wq)
633633
goto out;
634634

635-
nfsd_file_hashtbl = kcalloc(NFSD_FILE_HASH_SIZE,
635+
nfsd_file_hashtbl = kvcalloc(NFSD_FILE_HASH_SIZE,
636636
sizeof(*nfsd_file_hashtbl), GFP_KERNEL);
637637
if (!nfsd_file_hashtbl) {
638638
pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n");
@@ -700,7 +700,7 @@ nfsd_file_cache_init(void)
700700
nfsd_file_slab = NULL;
701701
kmem_cache_destroy(nfsd_file_mark_slab);
702702
nfsd_file_mark_slab = NULL;
703-
kfree(nfsd_file_hashtbl);
703+
kvfree(nfsd_file_hashtbl);
704704
nfsd_file_hashtbl = NULL;
705705
destroy_workqueue(nfsd_filecache_wq);
706706
nfsd_filecache_wq = NULL;
@@ -811,7 +811,7 @@ nfsd_file_cache_shutdown(void)
811811
fsnotify_wait_marks_destroyed();
812812
kmem_cache_destroy(nfsd_file_mark_slab);
813813
nfsd_file_mark_slab = NULL;
814-
kfree(nfsd_file_hashtbl);
814+
kvfree(nfsd_file_hashtbl);
815815
nfsd_file_hashtbl = NULL;
816816
destroy_workqueue(nfsd_filecache_wq);
817817
nfsd_filecache_wq = NULL;

0 commit comments

Comments
 (0)