aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/super.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 0343ebcfbbdc..0d14704c539e 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -778,15 +778,13 @@ static int nfs_verify_server_address(struct sockaddr *addr)
778 * Select between a default port value and a user-specified port value. 778 * Select between a default port value and a user-specified port value.
779 * If a zero value is set, then autobind will be used. 779 * If a zero value is set, then autobind will be used.
780 */ 780 */
781static void nfs_set_default_port(struct sockaddr *sap, const int parsed_port, 781static void nfs_set_port(struct sockaddr *sap, int *port,
782 const unsigned short default_port) 782 const unsigned short default_port)
783{ 783{
784 unsigned short port = default_port; 784 if (*port == NFS_UNSPEC_PORT)
785 *port = default_port;
785 786
786 if (parsed_port != NFS_UNSPEC_PORT) 787 rpc_set_port(sap, *port);
787 port = parsed_port;
788
789 rpc_set_port(sap, port);
790} 788}
791 789
792/* 790/*
@@ -1477,7 +1475,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
1477 args->mount_server.addrlen = args->nfs_server.addrlen; 1475 args->mount_server.addrlen = args->nfs_server.addrlen;
1478 } 1476 }
1479 request.salen = args->mount_server.addrlen; 1477 request.salen = args->mount_server.addrlen;
1480 nfs_set_default_port(request.sap, args->mount_server.port, 0); 1478 nfs_set_port(request.sap, &args->mount_server.port, 0);
1481 1479
1482 /* 1480 /*
1483 * Now ask the mount server to map our export path 1481 * Now ask the mount server to map our export path
@@ -1767,7 +1765,7 @@ static int nfs_validate_mount_data(void *options,
1767 goto out_v4_not_compiled; 1765 goto out_v4_not_compiled;
1768#endif 1766#endif
1769 1767
1770 nfs_set_default_port(sap, args->nfs_server.port, 0); 1768 nfs_set_port(sap, &args->nfs_server.port, 0);
1771 1769
1772 nfs_set_mount_transport_protocol(args); 1770 nfs_set_mount_transport_protocol(args);
1773 1771
@@ -2331,7 +2329,7 @@ static int nfs4_validate_text_mount_data(void *options,
2331{ 2329{
2332 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; 2330 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
2333 2331
2334 nfs_set_default_port(sap, args->nfs_server.port, NFS_PORT); 2332 nfs_set_port(sap, &args->nfs_server.port, NFS_PORT);
2335 2333
2336 nfs_validate_transport_protocol(args); 2334 nfs_validate_transport_protocol(args);
2337 2335