summaryrefslogtreecommitdiff
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-05-11 00:47:19 +0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-05-15 04:42:22 +0400
commit2ba68002a74fb167b68844077d36e5ccfc87f323 (patch)
tree9a84b5849145275bda0ba74aa24b4354299bdf0e /fs/nfs/client.c
parent5e7e5a0da28216fb9d0a49e93ee27668ef4f04f7 (diff)
downloadlinux-2ba68002a74fb167b68844077d36e5ccfc87f323.tar.xz
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/nfs/client.c')
-rw-r--r--fs/nfs/client.c16
1 files changed, 14 insertions, 2 deletions
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;
* RPC cruft for NFS
*/
static const struct rpc_version *nfs_version[5] = {
+#ifdef CONFIG_NFS_V2
[2] = &nfs_version2,
+#endif
#ifdef CONFIG_NFS_V3
[3] = &nfs_version3,
#endif
@@ -847,7 +849,7 @@ static int nfs_init_server(struct nfs_server *server,
.hostname = data->nfs_server.hostname,
.addr = (const struct sockaddr *)&data->nfs_server.address,
.addrlen = data->nfs_server.addrlen,
- .rpc_ops = &nfs_v2_clientops,
+ .rpc_ops = NULL,
.proto = data->nfs_server.protocol,
.net = data->net,
};
@@ -857,10 +859,20 @@ static int nfs_init_server(struct nfs_server *server,
dprintk("--> nfs_init_server()\n");
+ switch (data->version) {
+#ifdef CONFIG_NFS_V2
+ case 2:
+ cl_init.rpc_ops = &nfs_v2_clientops;
+ break;
+#endif
#ifdef CONFIG_NFS_V3
- if (data->version == 3)
+ case 3:
cl_init.rpc_ops = &nfs_v3_clientops;
+ break;
#endif
+ default:
+ return -EPROTONOSUPPORT;
+ }
nfs_init_timeout_values(&timeparms, data->nfs_server.protocol,
data->timeo, data->retrans);