From: Jeff Layton <jlayton@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>,
Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] nfsd: more robust allocation failure handling in nfsd_file_cache_init
Date: Thu, 24 Feb 2022 11:45:11 -0500 [thread overview]
Message-ID: <605c45f5fd1830eb98d78dec05ae55a879710e9e.camel@kernel.org> (raw)
In-Reply-To: <20220224161705.1041788-1-amir73il@gmail.com>
On Thu, 2022-02-24 at 18:17 +0200, Amir Goldstein wrote:
> 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>
> ---
>
> Since v1:
> - Use kvcalloc()
> - Use kvfree()
>
> fs/nfsd/filecache.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 8bc807c5fea4..cc2831cec669 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -632,7 +632,7 @@ nfsd_file_cache_init(void)
> if (!nfsd_filecache_wq)
> goto out;
>
> - nfsd_file_hashtbl = kcalloc(NFSD_FILE_HASH_SIZE,
> + nfsd_file_hashtbl = kvcalloc(NFSD_FILE_HASH_SIZE,
> sizeof(*nfsd_file_hashtbl), GFP_KERNEL);
> if (!nfsd_file_hashtbl) {
> pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n");
> @@ -700,7 +700,7 @@ nfsd_file_cache_init(void)
> nfsd_file_slab = NULL;
> kmem_cache_destroy(nfsd_file_mark_slab);
> nfsd_file_mark_slab = NULL;
> - kfree(nfsd_file_hashtbl);
> + kvfree(nfsd_file_hashtbl);
> nfsd_file_hashtbl = NULL;
> destroy_workqueue(nfsd_filecache_wq);
> nfsd_filecache_wq = NULL;
> @@ -811,7 +811,7 @@ nfsd_file_cache_shutdown(void)
> fsnotify_wait_marks_destroyed();
> kmem_cache_destroy(nfsd_file_mark_slab);
> nfsd_file_mark_slab = NULL;
> - kfree(nfsd_file_hashtbl);
> + kvfree(nfsd_file_hashtbl);
> nfsd_file_hashtbl = NULL;
> destroy_workqueue(nfsd_filecache_wq);
> nfsd_filecache_wq = NULL;
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2022-02-24 16:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 16:17 [PATCH v2] nfsd: more robust allocation failure handling in nfsd_file_cache_init Amir Goldstein
2022-02-24 16:45 ` Jeff Layton [this message]
2022-02-24 20:17 ` Chuck Lever III
2022-02-24 21:39 ` Amir Goldstein
2022-02-26 18:37 ` Amir Goldstein
2022-02-26 20:00 ` Chuck Lever III
2022-02-24 21:49 ` NeilBrown
2022-02-24 21:56 ` Chuck Lever III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=605c45f5fd1830eb98d78dec05ae55a879710e9e.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=amir73il@gmail.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox