nfsd: increase DRC cache limit [Linux 4.4.187]

This Linux kernel change "nfsd: increase DRC cache limit" is included in the Linux 4.4.187 release. This change is authored by J. Bruce Fields <bfields [at] redhat.com> on Tue Sep 19 20:51:31 2017 -0400. The commit for this change in Linux stable tree is c499d67 (patch) which is from upstream commit 44d8660. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 44d8660.

nfsd: increase DRC cache limit

[ Upstream commit 44d8660d3bb0a1c8363ebcb906af2343ea8e15f6 ]

An NFSv4.1+ client negotiates the size of its duplicate reply cache size
in the initial CREATE_SESSION request.  The server preallocates the
memory for the duplicate reply cache to ensure that we'll never fail to
record the response to a nonidempotent operation.

To prevent a few CREATE_SESSIONs from consuming all of memory we set an
upper limit based on nr_free_buffer_pages().  1/2^10 has been too
limiting in practice; 1/2^7 is still less than one percent.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/nfsd/nfssvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index b6eb56d..0fa990f 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -360,7 +360,7 @@ void nfsd_reset_versions(void)
  */
 static void set_max_drc(void)
 {
-   #define NFSD_DRC_SIZE_SHIFT 10
+   #define NFSD_DRC_SIZE_SHIFT 7
    nfsd_drc_max_mem = (nr_free_buffer_pages()
                    >> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
    nfsd_drc_mem_used = 0;

Leave a Reply

Your email address will not be published. Required fields are marked *