aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/client.c4
-rw-r--r--fs/nfs/internal.h1
-rw-r--r--fs/nfs/super.c37
-rw-r--r--include/linux/nfs_fs_sb.h1
4 files changed, 12 insertions, 31 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 06f064d8fbbe..874018113d0e 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -682,6 +682,8 @@ static int nfs_init_server(struct nfs_server *server,
682 if (error < 0) 682 if (error < 0)
683 goto error; 683 goto error;
684 684
685 server->port = data->nfs_server.port;
686
685 error = nfs_init_server_rpcclient(server, &timeparms, data->auth_flavors[0]); 687 error = nfs_init_server_rpcclient(server, &timeparms, data->auth_flavors[0]);
686 if (error < 0) 688 if (error < 0)
687 goto error; 689 goto error;
@@ -1064,6 +1066,8 @@ static int nfs4_init_server(struct nfs_server *server,
1064 server->acdirmin = data->acdirmin * HZ; 1066 server->acdirmin = data->acdirmin * HZ;
1065 server->acdirmax = data->acdirmax * HZ; 1067 server->acdirmax = data->acdirmax * HZ;
1066 1068
1069 server->port = data->nfs_server.port;
1070
1067 error = nfs_init_server_rpcclient(server, &timeparms, data->auth_flavors[0]); 1071 error = nfs_init_server_rpcclient(server, &timeparms, data->auth_flavors[0]);
1068 1072
1069error: 1073error:
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index e89688a955bf..999ad8ee0645 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -56,6 +56,7 @@ struct nfs_parsed_mount_data {
56 size_t addrlen; 56 size_t addrlen;
57 char *hostname; 57 char *hostname;
58 char *export_path; 58 char *export_path;
59 unsigned short port;
59 unsigned short protocol; 60 unsigned short protocol;
60 } nfs_server; 61 } nfs_server;
61 62
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 53a67c6d4d2a..3c6f53aa7317 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -685,7 +685,6 @@ static int nfs_parse_mount_options(char *raw,
685 struct nfs_parsed_mount_data *mnt) 685 struct nfs_parsed_mount_data *mnt)
686{ 686{
687 char *p, *string, *secdata; 687 char *p, *string, *secdata;
688 unsigned short port = 0;
689 int rc; 688 int rc;
690 689
691 if (!raw) { 690 if (!raw) {
@@ -800,7 +799,7 @@ static int nfs_parse_mount_options(char *raw,
800 return 0; 799 return 0;
801 if (option < 0 || option > 65535) 800 if (option < 0 || option > 65535)
802 return 0; 801 return 0;
803 port = option; 802 mnt->nfs_server.port = option;
804 break; 803 break;
805 case Opt_rsize: 804 case Opt_rsize:
806 if (match_int(args, &mnt->rsize)) 805 if (match_int(args, &mnt->rsize))
@@ -1050,7 +1049,8 @@ static int nfs_parse_mount_options(char *raw,
1050 } 1049 }
1051 } 1050 }
1052 1051
1053 nfs_set_port((struct sockaddr *)&mnt->nfs_server.address, port); 1052 nfs_set_port((struct sockaddr *)&mnt->nfs_server.address,
1053 mnt->nfs_server.port);
1054 1054
1055 return 1; 1055 return 1;
1056 1056
@@ -1171,7 +1171,9 @@ static int nfs_validate_mount_data(void *options,
1171 args->acregmax = 60; 1171 args->acregmax = 60;
1172 args->acdirmin = 30; 1172 args->acdirmin = 30;
1173 args->acdirmax = 60; 1173 args->acdirmax = 60;
1174 args->mount_server.port = 0; /* autobind unless user sets port */
1174 args->mount_server.protocol = XPRT_TRANSPORT_UDP; 1175 args->mount_server.protocol = XPRT_TRANSPORT_UDP;
1176 args->nfs_server.port = 0; /* autobind unless user sets port */
1175 args->nfs_server.protocol = XPRT_TRANSPORT_TCP; 1177 args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1176 1178
1177 switch (data->version) { 1179 switch (data->version) {
@@ -1708,28 +1710,6 @@ static void nfs4_fill_super(struct super_block *sb)
1708} 1710}
1709 1711
1710/* 1712/*
1711 * If the user didn't specify a port, set the port number to
1712 * the NFS version 4 default port.
1713 */
1714static void nfs4_default_port(struct sockaddr *sap)
1715{
1716 switch (sap->sa_family) {
1717 case AF_INET: {
1718 struct sockaddr_in *ap = (struct sockaddr_in *)sap;
1719 if (ap->sin_port == 0)
1720 ap->sin_port = htons(NFS_PORT);
1721 break;
1722 }
1723 case AF_INET6: {
1724 struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
1725 if (ap->sin6_port == 0)
1726 ap->sin6_port = htons(NFS_PORT);
1727 break;
1728 }
1729 }
1730}
1731
1732/*
1733 * Validate NFSv4 mount options 1713 * Validate NFSv4 mount options
1734 */ 1714 */
1735static int nfs4_validate_mount_data(void *options, 1715static int nfs4_validate_mount_data(void *options,
@@ -1753,6 +1733,7 @@ static int nfs4_validate_mount_data(void *options,
1753 args->acregmax = 60; 1733 args->acregmax = 60;
1754 args->acdirmin = 30; 1734 args->acdirmin = 30;
1755 args->acdirmax = 60; 1735 args->acdirmax = 60;
1736 args->nfs_server.port = NFS_PORT; /* 2049 unless user set port= */
1756 args->nfs_server.protocol = XPRT_TRANSPORT_TCP; 1737 args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1757 1738
1758 switch (data->version) { 1739 switch (data->version) {
@@ -1769,9 +1750,6 @@ static int nfs4_validate_mount_data(void *options,
1769 &args->nfs_server.address)) 1750 &args->nfs_server.address))
1770 goto out_no_address; 1751 goto out_no_address;
1771 1752
1772 nfs4_default_port((struct sockaddr *)
1773 &args->nfs_server.address);
1774
1775 switch (data->auth_flavourlen) { 1753 switch (data->auth_flavourlen) {
1776 case 0: 1754 case 0:
1777 args->auth_flavors[0] = RPC_AUTH_UNIX; 1755 args->auth_flavors[0] = RPC_AUTH_UNIX;
@@ -1829,9 +1807,6 @@ static int nfs4_validate_mount_data(void *options,
1829 &args->nfs_server.address)) 1807 &args->nfs_server.address))
1830 return -EINVAL; 1808 return -EINVAL;
1831 1809
1832 nfs4_default_port((struct sockaddr *)
1833 &args->nfs_server.address);
1834
1835 switch (args->auth_flavor_len) { 1810 switch (args->auth_flavor_len) {
1836 case 0: 1811 case 0:
1837 args->auth_flavors[0] = RPC_AUTH_UNIX; 1812 args->auth_flavors[0] = RPC_AUTH_UNIX;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3423c6761bf7..670e5c7222d0 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -93,6 +93,7 @@ struct nfs_server {
93 unsigned int wpages; /* write size (in pages) */ 93 unsigned int wpages; /* write size (in pages) */
94 unsigned int wtmult; /* server disk block size */ 94 unsigned int wtmult; /* server disk block size */
95 unsigned int dtsize; /* readdir size */ 95 unsigned int dtsize; /* readdir size */
96 unsigned short port; /* "port=" setting */
96 unsigned int bsize; /* server block size */ 97 unsigned int bsize; /* server block size */
97 unsigned int acregmin; /* attr cache timeouts */ 98 unsigned int acregmin; /* attr cache timeouts */
98 unsigned int acregmax; 99 unsigned int acregmax;