diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-05-10 16:47:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-14 20:42:22 -0400 |
commit | 2ba68002a74fb167b68844077d36e5ccfc87f323 (patch) | |
tree | 9a84b5849145275bda0ba74aa24b4354299bdf0e /fs | |
parent | 5e7e5a0da28216fb9d0a49e93ee27668ef4f04f7 (diff) |
NFS: Make v2 configurable
With this patch NFS v2 can be disabled during Kconfig. I default the
option to "y" to match the current behavior.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/Kconfig | 10 | ||||
-rw-r--r-- | fs/nfs/Makefile | 5 | ||||
-rw-r--r-- | fs/nfs/client.c | 16 |
3 files changed, 27 insertions, 4 deletions
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig index 2a0e6c599147..66b0f4cb520f 100644 --- a/fs/nfs/Kconfig +++ b/fs/nfs/Kconfig | |||
@@ -29,6 +29,16 @@ config NFS_FS | |||
29 | 29 | ||
30 | If unsure, say N. | 30 | If unsure, say N. |
31 | 31 | ||
32 | config NFS_V2 | ||
33 | bool "NFS client support for NFS version 2" | ||
34 | depends on NFS_FS | ||
35 | default y | ||
36 | help | ||
37 | This option enables support for version 2 of the NFS protocol | ||
38 | (RFC 1094) in the kernel's NFS client. | ||
39 | |||
40 | If unsure, say Y. | ||
41 | |||
32 | config NFS_V3 | 42 | config NFS_V3 |
33 | bool "NFS client support for NFS version 3" | 43 | bool "NFS client support for NFS version 3" |
34 | depends on NFS_FS | 44 | depends on NFS_FS |
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index b58613d0abb3..7ddd45d9f170 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
@@ -4,11 +4,12 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_NFS_FS) += nfs.o | 5 | obj-$(CONFIG_NFS_FS) += nfs.o |
6 | 6 | ||
7 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \ | 7 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o \ |
8 | direct.o pagelist.o proc.o read.o symlink.o unlink.o \ | 8 | direct.o pagelist.o read.o symlink.o unlink.o \ |
9 | write.o namespace.o mount_clnt.o \ | 9 | write.o namespace.o mount_clnt.o \ |
10 | dns_resolve.o cache_lib.o | 10 | dns_resolve.o cache_lib.o |
11 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o | 11 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o |
12 | nfs-$(CONFIG_NFS_V2) += proc.o nfs2xdr.o | ||
12 | nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o | 13 | nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o |
13 | nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o | 14 | nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o |
14 | nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ | 15 | nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index a8f8de618d73..8f1c65210afb 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -90,7 +90,9 @@ static bool nfs4_disable_idmapping = true; | |||
90 | * RPC cruft for NFS | 90 | * RPC cruft for NFS |
91 | */ | 91 | */ |
92 | static const struct rpc_version *nfs_version[5] = { | 92 | static const struct rpc_version *nfs_version[5] = { |
93 | #ifdef CONFIG_NFS_V2 | ||
93 | [2] = &nfs_version2, | 94 | [2] = &nfs_version2, |
95 | #endif | ||
94 | #ifdef CONFIG_NFS_V3 | 96 | #ifdef CONFIG_NFS_V3 |
95 | [3] = &nfs_version3, | 97 | [3] = &nfs_version3, |
96 | #endif | 98 | #endif |
@@ -847,7 +849,7 @@ static int nfs_init_server(struct nfs_server *server, | |||
847 | .hostname = data->nfs_server.hostname, | 849 | .hostname = data->nfs_server.hostname, |
848 | .addr = (const struct sockaddr *)&data->nfs_server.address, | 850 | .addr = (const struct sockaddr *)&data->nfs_server.address, |
849 | .addrlen = data->nfs_server.addrlen, | 851 | .addrlen = data->nfs_server.addrlen, |
850 | .rpc_ops = &nfs_v2_clientops, | 852 | .rpc_ops = NULL, |
851 | .proto = data->nfs_server.protocol, | 853 | .proto = data->nfs_server.protocol, |
852 | .net = data->net, | 854 | .net = data->net, |
853 | }; | 855 | }; |
@@ -857,10 +859,20 @@ static int nfs_init_server(struct nfs_server *server, | |||
857 | 859 | ||
858 | dprintk("--> nfs_init_server()\n"); | 860 | dprintk("--> nfs_init_server()\n"); |
859 | 861 | ||
862 | switch (data->version) { | ||
863 | #ifdef CONFIG_NFS_V2 | ||
864 | case 2: | ||
865 | cl_init.rpc_ops = &nfs_v2_clientops; | ||
866 | break; | ||
867 | #endif | ||
860 | #ifdef CONFIG_NFS_V3 | 868 | #ifdef CONFIG_NFS_V3 |
861 | if (data->version == 3) | 869 | case 3: |
862 | cl_init.rpc_ops = &nfs_v3_clientops; | 870 | cl_init.rpc_ops = &nfs_v3_clientops; |
871 | break; | ||
863 | #endif | 872 | #endif |
873 | default: | ||
874 | return -EPROTONOSUPPORT; | ||
875 | } | ||
864 | 876 | ||
865 | nfs_init_timeout_values(&timeparms, data->nfs_server.protocol, | 877 | nfs_init_timeout_values(&timeparms, data->nfs_server.protocol, |
866 | data->timeo, data->retrans); | 878 | data->timeo, data->retrans); |