aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/client.c13
-rw-r--r--fs/nfs/super.c60
2 files changed, 50 insertions, 23 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index f2a092ca69b5..5ee23e7058b3 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -431,14 +431,14 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
431{ 431{
432 to->to_initval = timeo * HZ / 10; 432 to->to_initval = timeo * HZ / 10;
433 to->to_retries = retrans; 433 to->to_retries = retrans;
434 if (!to->to_retries)
435 to->to_retries = 2;
436 434
437 switch (proto) { 435 switch (proto) {
438 case XPRT_TRANSPORT_TCP: 436 case XPRT_TRANSPORT_TCP:
439 case XPRT_TRANSPORT_RDMA: 437 case XPRT_TRANSPORT_RDMA:
438 if (to->to_retries == 0)
439 to->to_retries = NFS_DEF_TCP_RETRANS;
440 if (to->to_initval == 0) 440 if (to->to_initval == 0)
441 to->to_initval = 60 * HZ; 441 to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10;
442 if (to->to_initval > NFS_MAX_TCP_TIMEOUT) 442 if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
443 to->to_initval = NFS_MAX_TCP_TIMEOUT; 443 to->to_initval = NFS_MAX_TCP_TIMEOUT;
444 to->to_increment = to->to_initval; 444 to->to_increment = to->to_initval;
@@ -450,14 +450,17 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
450 to->to_exponential = 0; 450 to->to_exponential = 0;
451 break; 451 break;
452 case XPRT_TRANSPORT_UDP: 452 case XPRT_TRANSPORT_UDP:
453 default: 453 if (to->to_retries == 0)
454 to->to_retries = NFS_DEF_UDP_RETRANS;
454 if (!to->to_initval) 455 if (!to->to_initval)
455 to->to_initval = 11 * HZ / 10; 456 to->to_initval = NFS_DEF_UDP_TIMEO * HZ / 10;
456 if (to->to_initval > NFS_MAX_UDP_TIMEOUT) 457 if (to->to_initval > NFS_MAX_UDP_TIMEOUT)
457 to->to_initval = NFS_MAX_UDP_TIMEOUT; 458 to->to_initval = NFS_MAX_UDP_TIMEOUT;
458 to->to_maxval = NFS_MAX_UDP_TIMEOUT; 459 to->to_maxval = NFS_MAX_UDP_TIMEOUT;
459 to->to_exponential = 1; 460 to->to_exponential = 1;
460 break; 461 break;
462 default:
463 BUG();
461 } 464 }
462} 465}
463 466
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 73a8e5970f02..9c1a960f5b94 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -817,6 +817,43 @@ static void nfs_parse_ip_address(char *string, size_t str_len,
817} 817}
818 818
819/* 819/*
820 * Sanity check the NFS transport protocol.
821 *
822 */
823static void nfs_validate_transport_protocol(struct nfs_parsed_mount_data *mnt)
824{
825 switch (mnt->nfs_server.protocol) {
826 case XPRT_TRANSPORT_UDP:
827 case XPRT_TRANSPORT_TCP:
828 case XPRT_TRANSPORT_RDMA:
829 break;
830 default:
831 mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP;
832 }
833}
834
835/*
836 * For text based NFSv2/v3 mounts, the mount protocol transport default
837 * settings should depend upon the specified NFS transport.
838 */
839static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
840{
841 nfs_validate_transport_protocol(mnt);
842
843 if (mnt->mount_server.protocol == XPRT_TRANSPORT_UDP ||
844 mnt->mount_server.protocol == XPRT_TRANSPORT_TCP)
845 return;
846 switch (mnt->nfs_server.protocol) {
847 case XPRT_TRANSPORT_UDP:
848 mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
849 break;
850 case XPRT_TRANSPORT_TCP:
851 case XPRT_TRANSPORT_RDMA:
852 mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
853 }
854}
855
856/*
820 * Error-check and convert a string of mount options from user space into 857 * Error-check and convert a string of mount options from user space into
821 * a data structure 858 * a data structure
822 */ 859 */
@@ -896,20 +933,14 @@ static int nfs_parse_mount_options(char *raw,
896 case Opt_udp: 933 case Opt_udp:
897 mnt->flags &= ~NFS_MOUNT_TCP; 934 mnt->flags &= ~NFS_MOUNT_TCP;
898 mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; 935 mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP;
899 mnt->timeo = 7;
900 mnt->retrans = 5;
901 break; 936 break;
902 case Opt_tcp: 937 case Opt_tcp:
903 mnt->flags |= NFS_MOUNT_TCP; 938 mnt->flags |= NFS_MOUNT_TCP;
904 mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; 939 mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP;
905 mnt->timeo = 600;
906 mnt->retrans = 2;
907 break; 940 break;
908 case Opt_rdma: 941 case Opt_rdma:
909 mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */ 942 mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */
910 mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; 943 mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
911 mnt->timeo = 600;
912 mnt->retrans = 2;
913 break; 944 break;
914 case Opt_acl: 945 case Opt_acl:
915 mnt->flags &= ~NFS_MOUNT_NOACL; 946 mnt->flags &= ~NFS_MOUNT_NOACL;
@@ -1103,21 +1134,15 @@ static int nfs_parse_mount_options(char *raw,
1103 case Opt_xprt_udp: 1134 case Opt_xprt_udp:
1104 mnt->flags &= ~NFS_MOUNT_TCP; 1135 mnt->flags &= ~NFS_MOUNT_TCP;
1105 mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; 1136 mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP;
1106 mnt->timeo = 7;
1107 mnt->retrans = 5;
1108 break; 1137 break;
1109 case Opt_xprt_tcp: 1138 case Opt_xprt_tcp:
1110 mnt->flags |= NFS_MOUNT_TCP; 1139 mnt->flags |= NFS_MOUNT_TCP;
1111 mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; 1140 mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1112 mnt->timeo = 600;
1113 mnt->retrans = 2;
1114 break; 1141 break;
1115 case Opt_xprt_rdma: 1142 case Opt_xprt_rdma:
1116 /* vector side protocols to TCP */ 1143 /* vector side protocols to TCP */
1117 mnt->flags |= NFS_MOUNT_TCP; 1144 mnt->flags |= NFS_MOUNT_TCP;
1118 mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; 1145 mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
1119 mnt->timeo = 600;
1120 mnt->retrans = 2;
1121 break; 1146 break;
1122 default: 1147 default:
1123 goto out_unrec_xprt; 1148 goto out_unrec_xprt;
@@ -1438,14 +1463,11 @@ static int nfs_validate_mount_data(void *options,
1438 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); 1463 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
1439 args->rsize = NFS_MAX_FILE_IO_SIZE; 1464 args->rsize = NFS_MAX_FILE_IO_SIZE;
1440 args->wsize = NFS_MAX_FILE_IO_SIZE; 1465 args->wsize = NFS_MAX_FILE_IO_SIZE;
1441 args->timeo = 600;
1442 args->retrans = 2;
1443 args->acregmin = 3; 1466 args->acregmin = 3;
1444 args->acregmax = 60; 1467 args->acregmax = 60;
1445 args->acdirmin = 30; 1468 args->acdirmin = 30;
1446 args->acdirmax = 60; 1469 args->acdirmax = 60;
1447 args->mount_server.port = 0; /* autobind unless user sets port */ 1470 args->mount_server.port = 0; /* autobind unless user sets port */
1448 args->mount_server.protocol = XPRT_TRANSPORT_UDP;
1449 args->nfs_server.port = 0; /* autobind unless user sets port */ 1471 args->nfs_server.port = 0; /* autobind unless user sets port */
1450 args->nfs_server.protocol = XPRT_TRANSPORT_TCP; 1472 args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1451 1473
@@ -1546,6 +1568,8 @@ static int nfs_validate_mount_data(void *options,
1546 &args->nfs_server.address)) 1568 &args->nfs_server.address))
1547 goto out_no_address; 1569 goto out_no_address;
1548 1570
1571 nfs_set_mount_transport_protocol(args);
1572
1549 status = nfs_parse_devname(dev_name, 1573 status = nfs_parse_devname(dev_name,
1550 &args->nfs_server.hostname, 1574 &args->nfs_server.hostname,
1551 PAGE_SIZE, 1575 PAGE_SIZE,
@@ -2095,14 +2119,11 @@ static int nfs4_validate_mount_data(void *options,
2095 2119
2096 args->rsize = NFS_MAX_FILE_IO_SIZE; 2120 args->rsize = NFS_MAX_FILE_IO_SIZE;
2097 args->wsize = NFS_MAX_FILE_IO_SIZE; 2121 args->wsize = NFS_MAX_FILE_IO_SIZE;
2098 args->timeo = 600;
2099 args->retrans = 2;
2100 args->acregmin = 3; 2122 args->acregmin = 3;
2101 args->acregmax = 60; 2123 args->acregmax = 60;
2102 args->acdirmin = 30; 2124 args->acdirmin = 30;
2103 args->acdirmax = 60; 2125 args->acdirmax = 60;
2104 args->nfs_server.port = NFS_PORT; /* 2049 unless user set port= */ 2126 args->nfs_server.port = NFS_PORT; /* 2049 unless user set port= */
2105 args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
2106 2127
2107 switch (data->version) { 2128 switch (data->version) {
2108 case 1: 2129 case 1:
@@ -2163,6 +2184,7 @@ static int nfs4_validate_mount_data(void *options,
2163 args->acdirmin = data->acdirmin; 2184 args->acdirmin = data->acdirmin;
2164 args->acdirmax = data->acdirmax; 2185 args->acdirmax = data->acdirmax;
2165 args->nfs_server.protocol = data->proto; 2186 args->nfs_server.protocol = data->proto;
2187 nfs_validate_transport_protocol(args);
2166 2188
2167 break; 2189 break;
2168 default: { 2190 default: {
@@ -2175,6 +2197,8 @@ static int nfs4_validate_mount_data(void *options,
2175 &args->nfs_server.address)) 2197 &args->nfs_server.address))
2176 return -EINVAL; 2198 return -EINVAL;
2177 2199
2200 nfs_validate_transport_protocol(args);
2201
2178 switch (args->auth_flavor_len) { 2202 switch (args->auth_flavor_len) {
2179 case 0: 2203 case 0:
2180 args->auth_flavors[0] = RPC_AUTH_UNIX; 2204 args->auth_flavors[0] = RPC_AUTH_UNIX;