aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/Makefile7
-rw-r--r--fs/nfs/nfs4_fs.h15
-rw-r--r--fs/nfs/nfs4super.c9
-rw-r--r--fs/nfs/nfs4sysctl.c68
-rw-r--r--fs/nfs/sysctl.c26
5 files changed, 98 insertions, 27 deletions
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 162a699134ca..4a78e76440f8 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -17,7 +17,12 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
17 callback.o callback_xdr.o callback_proc.o \ 17 callback.o callback_xdr.o callback_proc.o \
18 nfs4namespace.o 18 nfs4namespace.o
19nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o 19nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o
20nfs-$(CONFIG_SYSCTL) += sysctl.o 20
21ifeq ($(CONFIG_SYSCTL), y)
22nfs-y += sysctl.o
23nfs-$(CONFIG_NFS_V4) += nfs4sysctl.o
24endif
25
21nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o 26nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
22 27
23obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o 28obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 1a6ed3f9a32a..b508fef1a32b 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -368,6 +368,21 @@ extern const nfs4_stateid zero_stateid;
368int init_nfs_v4(void); 368int init_nfs_v4(void);
369void exit_nfs_v4(void); 369void exit_nfs_v4(void);
370 370
371/* nfs4sysctl.c */
372#ifdef CONFIG_SYSCTL
373int nfs4_register_sysctl(void);
374void nfs4_unregister_sysctl(void);
375#else
376static inline int nfs4_register_sysctl(void)
377{
378 return 0;
379}
380
381static inline int nfs4_unregister_sysctl(void)
382{
383}
384#endif
385
371/* nfs4xdr.c */ 386/* nfs4xdr.c */
372extern struct rpc_procinfo nfs4_procedures[]; 387extern struct rpc_procinfo nfs4_procedures[];
373 388
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 366e41459695..70c394e75ca1 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -3,6 +3,8 @@
3 */ 3 */
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/nfs_idmap.h> 5#include <linux/nfs_idmap.h>
6#include <linux/nfs_fs.h>
7#include "nfs4_fs.h"
6 8
7int __init init_nfs_v4(void) 9int __init init_nfs_v4(void)
8{ 10{
@@ -12,12 +14,19 @@ int __init init_nfs_v4(void)
12 if (err) 14 if (err)
13 goto out; 15 goto out;
14 16
17 err = nfs4_register_sysctl();
18 if (err)
19 goto out1;
20
15 return 0; 21 return 0;
22out1:
23 nfs_idmap_quit();
16out: 24out:
17 return err; 25 return err;
18} 26}
19 27
20void __exit exit_nfs_v4(void) 28void __exit exit_nfs_v4(void)
21{ 29{
30 nfs4_unregister_sysctl();
22 nfs_idmap_quit(); 31 nfs_idmap_quit();
23} 32}
diff --git a/fs/nfs/nfs4sysctl.c b/fs/nfs/nfs4sysctl.c
new file mode 100644
index 000000000000..5729bc8aa75d
--- /dev/null
+++ b/fs/nfs/nfs4sysctl.c
@@ -0,0 +1,68 @@
1/*
2 * linux/fs/nfs/nfs4sysctl.c
3 *
4 * Sysctl interface to NFS v4 parameters
5 *
6 * Copyright (c) 2006 Trond Myklebust <Trond.Myklebust@netapp.com>
7 */
8#include <linux/sysctl.h>
9#include <linux/nfs_idmap.h>
10#include <linux/nfs_fs.h>
11
12#include "callback.h"
13
14static const int nfs_set_port_min = 0;
15static const int nfs_set_port_max = 65535;
16static struct ctl_table_header *nfs4_callback_sysctl_table;
17
18static ctl_table nfs4_cb_sysctls[] = {
19 {
20 .procname = "nfs_callback_tcpport",
21 .data = &nfs_callback_set_tcpport,
22 .maxlen = sizeof(int),
23 .mode = 0644,
24 .proc_handler = proc_dointvec_minmax,
25 .extra1 = (int *)&nfs_set_port_min,
26 .extra2 = (int *)&nfs_set_port_max,
27 },
28 {
29 .procname = "idmap_cache_timeout",
30 .data = &nfs_idmap_cache_timeout,
31 .maxlen = sizeof(int),
32 .mode = 0644,
33 .proc_handler = proc_dointvec_jiffies,
34 },
35 { }
36};
37
38static ctl_table nfs4_cb_sysctl_dir[] = {
39 {
40 .procname = "nfs",
41 .mode = 0555,
42 .child = nfs4_cb_sysctls,
43 },
44 { }
45};
46
47static ctl_table nfs4_cb_sysctl_root[] = {
48 {
49 .procname = "fs",
50 .mode = 0555,
51 .child = nfs4_cb_sysctl_dir,
52 },
53 { }
54};
55
56int nfs4_register_sysctl(void)
57{
58 nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
59 if (nfs4_callback_sysctl_table == NULL)
60 return -ENOMEM;
61 return 0;
62}
63
64void nfs4_unregister_sysctl(void)
65{
66 unregister_sysctl_table(nfs4_callback_sysctl_table);
67 nfs4_callback_sysctl_table = NULL;
68}
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
index ad4d2e787b20..6b3f2535a3ec 100644
--- a/fs/nfs/sysctl.c
+++ b/fs/nfs/sysctl.c
@@ -9,37 +9,11 @@
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/sysctl.h> 10#include <linux/sysctl.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/nfs4.h>
13#include <linux/nfs_idmap.h>
14#include <linux/nfs_fs.h> 12#include <linux/nfs_fs.h>
15 13
16#include "callback.h"
17
18#ifdef CONFIG_NFS_V4
19static const int nfs_set_port_min = 0;
20static const int nfs_set_port_max = 65535;
21#endif
22static struct ctl_table_header *nfs_callback_sysctl_table; 14static struct ctl_table_header *nfs_callback_sysctl_table;
23 15
24static ctl_table nfs_cb_sysctls[] = { 16static ctl_table nfs_cb_sysctls[] = {
25#ifdef CONFIG_NFS_V4
26 {
27 .procname = "nfs_callback_tcpport",
28 .data = &nfs_callback_set_tcpport,
29 .maxlen = sizeof(int),
30 .mode = 0644,
31 .proc_handler = proc_dointvec_minmax,
32 .extra1 = (int *)&nfs_set_port_min,
33 .extra2 = (int *)&nfs_set_port_max,
34 },
35 {
36 .procname = "idmap_cache_timeout",
37 .data = &nfs_idmap_cache_timeout,
38 .maxlen = sizeof(int),
39 .mode = 0644,
40 .proc_handler = proc_dointvec_jiffies,
41 },
42#endif
43 { 17 {
44 .procname = "nfs_mountpoint_timeout", 18 .procname = "nfs_mountpoint_timeout",
45 .data = &nfs_mountpoint_expiry_timeout, 19 .data = &nfs_mountpoint_expiry_timeout,