All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] Add /proc/sys/fs/nfs sysctls to nfsd module
@ 2006-08-03 11:05 Olaf Kirch
  2006-08-03 16:52 ` Chuck Lever
  0 siblings, 1 reply; 13+ messages in thread
From: Olaf Kirch @ 2006-08-03 11:05 UTC (permalink / raw)
  To: nfs

From: okir@suse.de
Subject: Add /proc/sys/fs/nfs sysctls to nfsd module

  This patch adds the plumbing for adding nfs-specific sysctls to fs/nfs,
  and makes the max size of a readdirplus reply tunable.

  The reason for this is that we found that some clients do not seem
  to grok readdirplus replies larger than 4K. Rather than reducing the
  overall number this sysctl allows admins to work around these clients.

Signed-off-by: Olaf Kirch <okir@suse.de>

 fs/nfsd/nfs3xdr.c         |    5 ++++-
 fs/nfsd/nfsctl.c          |   28 ++++++++++++++++++++++++++++
 include/linux/nfsd/xdr3.h |    4 ++++
 3 files changed, 36 insertions(+), 1 deletion(-)

Index: linux-2.6.18/fs/nfsd/nfsctl.c
===================================================================
--- linux-2.6.18.orig/fs/nfsd/nfsctl.c
+++ linux-2.6.18/fs/nfsd/nfsctl.c
@@ -31,6 +31,7 @@
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/cache.h>
 #include <linux/nfsd/xdr.h>
+#include <linux/nfsd/xdr3.h>
 #include <linux/nfsd/syscall.h>
 #include <linux/nfsd/interface.h>
 
@@ -507,8 +508,28 @@ static struct file_system_type nfsd_fs_t
 	.kill_sb	= kill_litter_super,
 };
 
+ /*
+ * NFS sysctls
+ */
+static struct ctl_table_header *nfsd_sysctl_table;
+
+static ctl_table nfsd_sysctls[] = {
+	{
+		.ctl_name	= -2,
+		.procname	= "nfsd_readdirplus_max",
+		.data		= &nfsd_readdirplus_max,
+		.maxlen		= sizeof(nfsd_readdirplus_max),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.extra1		= &nfsd_readdirplus_max_lb,
+		.extra2		= &nfsd_readdirplus_max_ub,
+	},
+	{ .ctl_name = 0 }
+};
+
 static int __init init_nfsd(void)
 {
+	struct ctl_path ctl_path[] = { { CTL_FS, "fs", 0555 }, { -2, "nfs", 0555 }, { 0 } };
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
 
@@ -518,6 +539,7 @@ static int __init init_nfsd(void)
 	nfsd_lockd_init();	/* lockd->nfsd callbacks */
 	nfs4_state_init();	/* NFSv4 locking state */
 	nfsd_idmap_init();      /* Name to ID mapping */
+	nfsd_sysctl_table = register_sysctl_table_path(nfsd_sysctls, ctl_path);
 	if (proc_mkdir("fs/nfs", NULL)) {
 		struct proc_dir_entry *entry;
 		entry = create_proc_entry("fs/nfs/exports", 0, NULL);
@@ -532,6 +554,9 @@ static int __init init_nfsd(void)
 		remove_proc_entry("fs/nfs", NULL);
 		nfsd_stat_shutdown();
 		nfsd_lockd_shutdown();
+		if (nfsd_sysctl_table)
+			unregister_sysctl_table(nfsd_sysctl_table);
+		nfsd_sysctl_table = NULL;
 	}
 	return retval;
 }
@@ -546,6 +571,9 @@ static void __exit exit_nfsd(void)
 	nfsd_lockd_shutdown();
 	nfsd_idmap_shutdown();
 	unregister_filesystem(&nfsd_fs_type);
+	if (nfsd_sysctl_table)
+		unregister_sysctl_table(nfsd_sysctl_table);
+	nfsd_sysctl_table = NULL;
 }
 
 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
Index: linux-2.6.18/fs/nfsd/nfs3xdr.c
===================================================================
--- linux-2.6.18.orig/fs/nfsd/nfs3xdr.c
+++ linux-2.6.18/fs/nfsd/nfs3xdr.c
@@ -28,6 +28,9 @@
 # define inline
 #endif
 
+unsigned int	nfsd_readdirplus_max = NFSSVC_MAXBLKSIZE;
+unsigned int	nfsd_readdirplus_max_lb = 512;
+unsigned int	nfsd_readdirplus_max_ub = NFSSVC_MAXBLKSIZE;
 
 /*
  * Mapping of S_IF* types to NFS file types
@@ -573,7 +576,7 @@ nfs3svc_decode_readdirplusargs(struct sv
 	args->dircount = ntohl(*p++);
 	args->count    = ntohl(*p++);
 
-	len = (args->count > NFSSVC_MAXBLKSIZE) ? NFSSVC_MAXBLKSIZE :
+	len = (args->count > nfsd_readdirplus_max) ? nfsd_readdirplus_max :
 						  args->count;
 	args->count = len;
 
Index: linux-2.6.18/include/linux/nfsd/xdr3.h
===================================================================
--- linux-2.6.18.orig/include/linux/nfsd/xdr3.h
+++ linux-2.6.18/include/linux/nfsd/xdr3.h
@@ -268,6 +268,10 @@ union nfsd3_xdrstore {
 
 #define NFS3_SVC_XDRSIZE		sizeof(union nfsd3_xdrstore)
 
+extern unsigned int			nfsd_readdirplus_max;
+extern unsigned int			nfsd_readdirplus_max_ub;
+extern unsigned int			nfsd_readdirplus_max_lb;
+
 int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
 int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *,
 				struct nfsd3_sattrargs *);

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-08-07  4:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03 11:05 [PATCH 3/4] Add /proc/sys/fs/nfs sysctls to nfsd module Olaf Kirch
2006-08-03 16:52 ` Chuck Lever
2006-08-03 17:08   ` Trond Myklebust
2006-08-04 17:55     ` Olaf Kirch
2006-08-04  8:43   ` Greg Banks
2006-08-04 15:36     ` Trond Myklebust
2006-08-04 17:52       ` Olaf Kirch
2006-08-04 18:23         ` Trond Myklebust
2006-08-04 19:16           ` Peter Staubach
2006-08-04 20:06             ` Olaf Kirch
2006-08-07  4:02             ` Trond Myklebust
2006-08-04 23:36     ` Neil Brown
2006-08-05 13:15       ` Olaf Kirch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.