aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-03 16:29:06 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:06:00 -0500
commit59dca3b28cb915745019d4f4c27d97b6b6ab12c6 (patch)
tree6e3bde647bba09070ece738af13ce4bf569ba95e
parent331702337f2b2e7cef40366ee207a25604df4671 (diff)
NFS: Fix the 'proto=' mount option
Currently, if you have a server mounted using networking protocol, you cannot specify a different value using the 'proto=' option on another mountpoint. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/client.c20
-rw-r--r--include/linux/nfs_fs_sb.h1
2 files changed, 14 insertions, 7 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 03d9bed7849a..18fcb05a0707 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -100,6 +100,7 @@ struct nfs_client_initdata {
100 const struct sockaddr *addr; 100 const struct sockaddr *addr;
101 size_t addrlen; 101 size_t addrlen;
102 const struct nfs_rpc_ops *rpc_ops; 102 const struct nfs_rpc_ops *rpc_ops;
103 int proto;
103}; 104};
104 105
105/* 106/*
@@ -138,6 +139,8 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
138 INIT_LIST_HEAD(&clp->cl_superblocks); 139 INIT_LIST_HEAD(&clp->cl_superblocks);
139 clp->cl_rpcclient = ERR_PTR(-EINVAL); 140 clp->cl_rpcclient = ERR_PTR(-EINVAL);
140 141
142 clp->cl_proto = cl_init->proto;
143
141#ifdef CONFIG_NFS_V4 144#ifdef CONFIG_NFS_V4
142 init_rwsem(&clp->cl_sem); 145 init_rwsem(&clp->cl_sem);
143 INIT_LIST_HEAD(&clp->cl_delegations); 146 INIT_LIST_HEAD(&clp->cl_delegations);
@@ -289,6 +292,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
289 if (clp->rpc_ops != data->rpc_ops) 292 if (clp->rpc_ops != data->rpc_ops)
290 continue; 293 continue;
291 294
295 if (clp->cl_proto != data->proto)
296 continue;
297
292 /* Match the full socket address */ 298 /* Match the full socket address */
293 if (memcmp(&clp->cl_addr, data->addr, sizeof(clp->cl_addr)) != 0) 299 if (memcmp(&clp->cl_addr, data->addr, sizeof(clp->cl_addr)) != 0)
294 continue; 300 continue;
@@ -414,14 +420,14 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
414/* 420/*
415 * Create an RPC client handle 421 * Create an RPC client handle
416 */ 422 */
417static int nfs_create_rpc_client(struct nfs_client *clp, int proto, 423static int nfs_create_rpc_client(struct nfs_client *clp,
418 const struct rpc_timeout *timeparms, 424 const struct rpc_timeout *timeparms,
419 rpc_authflavor_t flavor, 425 rpc_authflavor_t flavor,
420 int flags) 426 int flags)
421{ 427{
422 struct rpc_clnt *clnt = NULL; 428 struct rpc_clnt *clnt = NULL;
423 struct rpc_create_args args = { 429 struct rpc_create_args args = {
424 .protocol = proto, 430 .protocol = clp->cl_proto,
425 .address = (struct sockaddr *)&clp->cl_addr, 431 .address = (struct sockaddr *)&clp->cl_addr,
426 .addrsize = clp->cl_addrlen, 432 .addrsize = clp->cl_addrlen,
427 .timeout = timeparms, 433 .timeout = timeparms,
@@ -565,8 +571,7 @@ static int nfs_init_client(struct nfs_client *clp,
565 * Create a client RPC handle for doing FSSTAT with UNIX auth only 571 * Create a client RPC handle for doing FSSTAT with UNIX auth only
566 * - RFC 2623, sec 2.3.2 572 * - RFC 2623, sec 2.3.2
567 */ 573 */
568 error = nfs_create_rpc_client(clp, data->nfs_server.protocol, 574 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX, 0);
569 timeparms, RPC_AUTH_UNIX, 0);
570 if (error < 0) 575 if (error < 0)
571 goto error; 576 goto error;
572 nfs_mark_client_ready(clp, NFS_CS_READY); 577 nfs_mark_client_ready(clp, NFS_CS_READY);
@@ -589,6 +594,7 @@ static int nfs_init_server(struct nfs_server *server,
589 .addr = (const struct sockaddr *)&data->nfs_server.address, 594 .addr = (const struct sockaddr *)&data->nfs_server.address,
590 .addrlen = data->nfs_server.addrlen, 595 .addrlen = data->nfs_server.addrlen,
591 .rpc_ops = &nfs_v2_clientops, 596 .rpc_ops = &nfs_v2_clientops,
597 .proto = data->nfs_server.protocol,
592 }; 598 };
593 struct rpc_timeout timeparms; 599 struct rpc_timeout timeparms;
594 struct nfs_client *clp; 600 struct nfs_client *clp;
@@ -894,7 +900,6 @@ error:
894 * Initialise an NFS4 client record 900 * Initialise an NFS4 client record
895 */ 901 */
896static int nfs4_init_client(struct nfs_client *clp, 902static int nfs4_init_client(struct nfs_client *clp,
897 int proto,
898 const struct rpc_timeout *timeparms, 903 const struct rpc_timeout *timeparms,
899 const char *ip_addr, 904 const char *ip_addr,
900 rpc_authflavor_t authflavour) 905 rpc_authflavor_t authflavour)
@@ -910,7 +915,7 @@ static int nfs4_init_client(struct nfs_client *clp,
910 /* Check NFS protocol revision and initialize RPC op vector */ 915 /* Check NFS protocol revision and initialize RPC op vector */
911 clp->rpc_ops = &nfs_v4_clientops; 916 clp->rpc_ops = &nfs_v4_clientops;
912 917
913 error = nfs_create_rpc_client(clp, proto, timeparms, authflavour, 918 error = nfs_create_rpc_client(clp, timeparms, authflavour,
914 RPC_CLNT_CREATE_DISCRTRY); 919 RPC_CLNT_CREATE_DISCRTRY);
915 if (error < 0) 920 if (error < 0)
916 goto error; 921 goto error;
@@ -949,6 +954,7 @@ static int nfs4_set_client(struct nfs_server *server,
949 .addr = addr, 954 .addr = addr,
950 .addrlen = addrlen, 955 .addrlen = addrlen,
951 .rpc_ops = &nfs_v4_clientops, 956 .rpc_ops = &nfs_v4_clientops,
957 .proto = proto,
952 }; 958 };
953 struct nfs_client *clp; 959 struct nfs_client *clp;
954 int error; 960 int error;
@@ -961,7 +967,7 @@ static int nfs4_set_client(struct nfs_server *server,
961 error = PTR_ERR(clp); 967 error = PTR_ERR(clp);
962 goto error; 968 goto error;
963 } 969 }
964 error = nfs4_init_client(clp, proto, timeparms, ip_addr, authflavour); 970 error = nfs4_init_client(clp, timeparms, ip_addr, authflavour);
965 if (error < 0) 971 if (error < 0)
966 goto error_put; 972 goto error_put;
967 973
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index d15c9487b8f1..b5ba5f79485d 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -29,6 +29,7 @@ struct nfs_client {
29 29
30 struct rpc_clnt * cl_rpcclient; 30 struct rpc_clnt * cl_rpcclient;
31 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 31 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
32 int cl_proto; /* Network transport protocol */
32 33
33#ifdef CONFIG_NFS_V4 34#ifdef CONFIG_NFS_V4
34 u64 cl_clientid; /* constant */ 35 u64 cl_clientid; /* constant */