diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 4 | ||||
-rw-r--r-- | fs/nfs/Makefile | 1 | ||||
-rw-r--r-- | fs/nfs/callback.c | 3 | ||||
-rw-r--r-- | fs/nfs/callback.h | 1 | ||||
-rw-r--r-- | fs/nfs/inode.c | 37 | ||||
-rw-r--r-- | fs/nfs/sysctl.c | 74 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 11 |
7 files changed, 128 insertions, 3 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 61a56b100c62..309c9cec6e7c 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -910,6 +910,10 @@ running once the system is up. | |||
910 | nfsroot= [NFS] nfs root filesystem for disk-less boxes. | 910 | nfsroot= [NFS] nfs root filesystem for disk-less boxes. |
911 | See Documentation/nfsroot.txt. | 911 | See Documentation/nfsroot.txt. |
912 | 912 | ||
913 | nfs.callback_tcpport= | ||
914 | [NFS] set the TCP port on which the NFSv4 callback | ||
915 | channel should listen. | ||
916 | |||
913 | nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels | 917 | nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels |
914 | 918 | ||
915 | no387 [BUGS=IA-32] Tells the kernel to use the 387 maths | 919 | no387 [BUGS=IA-32] Tells the kernel to use the 387 maths |
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index 8b3bb715d177..ec61fd56a1a9 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
@@ -13,4 +13,5 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ | |||
13 | delegation.o idmap.o \ | 13 | delegation.o idmap.o \ |
14 | callback.o callback_xdr.o callback_proc.o | 14 | callback.o callback_xdr.o callback_proc.o |
15 | nfs-$(CONFIG_NFS_DIRECTIO) += direct.o | 15 | nfs-$(CONFIG_NFS_DIRECTIO) += direct.o |
16 | nfs-$(CONFIG_SYSCTL) += sysctl.o | ||
16 | nfs-objs := $(nfs-y) | 17 | nfs-objs := $(nfs-y) |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 30cae3602867..fcd97406a778 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -34,6 +34,7 @@ static struct nfs_callback_data nfs_callback_info; | |||
34 | static DECLARE_MUTEX(nfs_callback_sema); | 34 | static DECLARE_MUTEX(nfs_callback_sema); |
35 | static struct svc_program nfs4_callback_program; | 35 | static struct svc_program nfs4_callback_program; |
36 | 36 | ||
37 | unsigned int nfs_callback_set_tcpport; | ||
37 | unsigned short nfs_callback_tcpport; | 38 | unsigned short nfs_callback_tcpport; |
38 | 39 | ||
39 | /* | 40 | /* |
@@ -98,7 +99,7 @@ int nfs_callback_up(void) | |||
98 | if (!serv) | 99 | if (!serv) |
99 | goto out_err; | 100 | goto out_err; |
100 | /* FIXME: We don't want to register this socket with the portmapper */ | 101 | /* FIXME: We don't want to register this socket with the portmapper */ |
101 | ret = svc_makesock(serv, IPPROTO_TCP, 0); | 102 | ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport); |
102 | if (ret < 0) | 103 | if (ret < 0) |
103 | goto out_destroy; | 104 | goto out_destroy; |
104 | if (!list_empty(&serv->sv_permsocks)) { | 105 | if (!list_empty(&serv->sv_permsocks)) { |
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index a0db2d4f9415..b252e7fe53a5 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h | |||
@@ -65,6 +65,7 @@ extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy); | |||
65 | extern int nfs_callback_up(void); | 65 | extern int nfs_callback_up(void); |
66 | extern int nfs_callback_down(void); | 66 | extern int nfs_callback_down(void); |
67 | 67 | ||
68 | extern unsigned int nfs_callback_set_tcpport; | ||
68 | extern unsigned short nfs_callback_tcpport; | 69 | extern unsigned short nfs_callback_tcpport; |
69 | 70 | ||
70 | #endif /* __LINUX_FS_NFS_CALLBACK_H */ | 71 | #endif /* __LINUX_FS_NFS_CALLBACK_H */ |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 7270b1d73d30..648cb1aef3b1 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | 41 | ||
42 | #include "nfs4_fs.h" | 42 | #include "nfs4_fs.h" |
43 | #include "callback.h" | ||
43 | #include "delegation.h" | 44 | #include "delegation.h" |
44 | 45 | ||
45 | #define NFSDBG_FACILITY NFSDBG_VFS | 46 | #define NFSDBG_FACILITY NFSDBG_VFS |
@@ -2036,6 +2037,21 @@ static struct file_system_type nfs4_fs_type = { | |||
2036 | .fs_flags = FS_ODD_RENAME|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, | 2037 | .fs_flags = FS_ODD_RENAME|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
2037 | }; | 2038 | }; |
2038 | 2039 | ||
2040 | static const int nfs_set_port_min = 0; | ||
2041 | static const int nfs_set_port_max = 65535; | ||
2042 | static int param_set_port(const char *val, struct kernel_param *kp) | ||
2043 | { | ||
2044 | char *endp; | ||
2045 | int num = simple_strtol(val, &endp, 0); | ||
2046 | if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max) | ||
2047 | return -EINVAL; | ||
2048 | *((int *)kp->arg) = num; | ||
2049 | return 0; | ||
2050 | } | ||
2051 | |||
2052 | module_param_call(callback_tcpport, param_set_port, param_get_int, | ||
2053 | &nfs_callback_set_tcpport, 0644); | ||
2054 | |||
2039 | #define nfs4_init_once(nfsi) \ | 2055 | #define nfs4_init_once(nfsi) \ |
2040 | do { \ | 2056 | do { \ |
2041 | INIT_LIST_HEAD(&(nfsi)->open_states); \ | 2057 | INIT_LIST_HEAD(&(nfsi)->open_states); \ |
@@ -2043,8 +2059,25 @@ static struct file_system_type nfs4_fs_type = { | |||
2043 | nfsi->delegation_state = 0; \ | 2059 | nfsi->delegation_state = 0; \ |
2044 | init_rwsem(&nfsi->rwsem); \ | 2060 | init_rwsem(&nfsi->rwsem); \ |
2045 | } while(0) | 2061 | } while(0) |
2046 | #define register_nfs4fs() register_filesystem(&nfs4_fs_type) | 2062 | |
2047 | #define unregister_nfs4fs() unregister_filesystem(&nfs4_fs_type) | 2063 | static inline int register_nfs4fs(void) |
2064 | { | ||
2065 | int ret; | ||
2066 | |||
2067 | ret = nfs_register_sysctl(); | ||
2068 | if (ret != 0) | ||
2069 | return ret; | ||
2070 | ret = register_filesystem(&nfs4_fs_type); | ||
2071 | if (ret != 0) | ||
2072 | nfs_unregister_sysctl(); | ||
2073 | return ret; | ||
2074 | } | ||
2075 | |||
2076 | static inline void unregister_nfs4fs(void) | ||
2077 | { | ||
2078 | unregister_filesystem(&nfs4_fs_type); | ||
2079 | nfs_unregister_sysctl(); | ||
2080 | } | ||
2048 | #else | 2081 | #else |
2049 | #define nfs4_init_once(nfsi) \ | 2082 | #define nfs4_init_once(nfsi) \ |
2050 | do { } while (0) | 2083 | do { } while (0) |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c new file mode 100644 index 000000000000..fdc64b59a4ee --- /dev/null +++ b/fs/nfs/sysctl.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * linux/fs/nfs/sysctl.c | ||
3 | * | ||
4 | * Sysctl interface to NFS parameters | ||
5 | */ | ||
6 | #include <linux/config.h> | ||
7 | #include <linux/types.h> | ||
8 | #include <linux/linkage.h> | ||
9 | #include <linux/ctype.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/sysctl.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/nfs4.h> | ||
14 | |||
15 | #include "callback.h" | ||
16 | |||
17 | static const int nfs_set_port_min = 0; | ||
18 | static const int nfs_set_port_max = 65535; | ||
19 | static struct ctl_table_header *nfs_callback_sysctl_table; | ||
20 | /* | ||
21 | * Something that isn't CTL_ANY, CTL_NONE or a value that may clash. | ||
22 | * Use the same values as fs/lockd/svc.c | ||
23 | */ | ||
24 | #define CTL_UNNUMBERED -2 | ||
25 | |||
26 | static ctl_table nfs_cb_sysctls[] = { | ||
27 | #ifdef CONFIG_NFS_V4 | ||
28 | { | ||
29 | .ctl_name = CTL_UNNUMBERED, | ||
30 | .procname = "nfs_callback_tcpport", | ||
31 | .data = &nfs_callback_set_tcpport, | ||
32 | .maxlen = sizeof(int), | ||
33 | .mode = 0644, | ||
34 | .proc_handler = &proc_dointvec_minmax, | ||
35 | .extra1 = (int *)&nfs_set_port_min, | ||
36 | .extra2 = (int *)&nfs_set_port_max, | ||
37 | }, | ||
38 | #endif | ||
39 | { .ctl_name = 0 } | ||
40 | }; | ||
41 | |||
42 | static ctl_table nfs_cb_sysctl_dir[] = { | ||
43 | { | ||
44 | .ctl_name = CTL_UNNUMBERED, | ||
45 | .procname = "nfs", | ||
46 | .mode = 0555, | ||
47 | .child = nfs_cb_sysctls, | ||
48 | }, | ||
49 | { .ctl_name = 0 } | ||
50 | }; | ||
51 | |||
52 | static ctl_table nfs_cb_sysctl_root[] = { | ||
53 | { | ||
54 | .ctl_name = CTL_FS, | ||
55 | .procname = "fs", | ||
56 | .mode = 0555, | ||
57 | .child = nfs_cb_sysctl_dir, | ||
58 | }, | ||
59 | { .ctl_name = 0 } | ||
60 | }; | ||
61 | |||
62 | int nfs_register_sysctl(void) | ||
63 | { | ||
64 | nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0); | ||
65 | if (nfs_callback_sysctl_table == NULL) | ||
66 | return -ENOMEM; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | void nfs_unregister_sysctl(void) | ||
71 | { | ||
72 | unregister_sysctl_table(nfs_callback_sysctl_table); | ||
73 | nfs_callback_sysctl_table = NULL; | ||
74 | } | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 408d82d3d97c..547d649b274e 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -392,6 +392,17 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_ | |||
392 | extern struct inode_operations nfs_symlink_inode_operations; | 392 | extern struct inode_operations nfs_symlink_inode_operations; |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * linux/fs/nfs/sysctl.c | ||
396 | */ | ||
397 | #ifdef CONFIG_SYSCTL | ||
398 | extern int nfs_register_sysctl(void); | ||
399 | extern void nfs_unregister_sysctl(void); | ||
400 | #else | ||
401 | #define nfs_register_sysctl() do { } while(0) | ||
402 | #define nfs_unregister_sysctl() do { } while(0) | ||
403 | #endif | ||
404 | |||
405 | /* | ||
395 | * linux/fs/nfs/unlink.c | 406 | * linux/fs/nfs/unlink.c |
396 | */ | 407 | */ |
397 | extern int nfs_async_unlink(struct dentry *); | 408 | extern int nfs_async_unlink(struct dentry *); |