diff options
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r-- | fs/nfs/super.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 29786d3b9326..a2c18acb8568 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -728,22 +728,24 @@ static void nfs_umount_begin(struct super_block *sb) | |||
728 | unlock_kernel(); | 728 | unlock_kernel(); |
729 | } | 729 | } |
730 | 730 | ||
731 | static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(int flags) | 731 | static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int version) |
732 | { | 732 | { |
733 | struct nfs_parsed_mount_data *data; | 733 | struct nfs_parsed_mount_data *data; |
734 | 734 | ||
735 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 735 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
736 | if (data) { | 736 | if (data) { |
737 | data->flags = flags; | ||
738 | data->rsize = NFS_MAX_FILE_IO_SIZE; | 737 | data->rsize = NFS_MAX_FILE_IO_SIZE; |
739 | data->wsize = NFS_MAX_FILE_IO_SIZE; | 738 | data->wsize = NFS_MAX_FILE_IO_SIZE; |
740 | data->acregmin = NFS_DEF_ACREGMIN; | 739 | data->acregmin = NFS_DEF_ACREGMIN; |
741 | data->acregmax = NFS_DEF_ACREGMAX; | 740 | data->acregmax = NFS_DEF_ACREGMAX; |
742 | data->acdirmin = NFS_DEF_ACDIRMIN; | 741 | data->acdirmin = NFS_DEF_ACDIRMIN; |
743 | data->acdirmax = NFS_DEF_ACDIRMAX; | 742 | data->acdirmax = NFS_DEF_ACDIRMAX; |
743 | data->mount_server.port = NFS_UNSPEC_PORT; | ||
744 | data->nfs_server.port = NFS_UNSPEC_PORT; | 744 | data->nfs_server.port = NFS_UNSPEC_PORT; |
745 | data->nfs_server.protocol = XPRT_TRANSPORT_TCP; | ||
745 | data->auth_flavors[0] = RPC_AUTH_UNIX; | 746 | data->auth_flavors[0] = RPC_AUTH_UNIX; |
746 | data->auth_flavor_len = 1; | 747 | data->auth_flavor_len = 1; |
748 | data->version = version; | ||
747 | data->minorversion = 0; | 749 | data->minorversion = 0; |
748 | } | 750 | } |
749 | return data; | 751 | return data; |
@@ -776,15 +778,13 @@ static int nfs_verify_server_address(struct sockaddr *addr) | |||
776 | * 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. |
777 | * If a zero value is set, then autobind will be used. | 779 | * If a zero value is set, then autobind will be used. |
778 | */ | 780 | */ |
779 | static void nfs_set_default_port(struct sockaddr *sap, const int parsed_port, | 781 | static void nfs_set_port(struct sockaddr *sap, int *port, |
780 | const unsigned short default_port) | 782 | const unsigned short default_port) |
781 | { | 783 | { |
782 | unsigned short port = default_port; | 784 | if (*port == NFS_UNSPEC_PORT) |
785 | *port = default_port; | ||
783 | 786 | ||
784 | if (parsed_port != NFS_UNSPEC_PORT) | 787 | rpc_set_port(sap, *port); |
785 | port = parsed_port; | ||
786 | |||
787 | rpc_set_port(sap, port); | ||
788 | } | 788 | } |
789 | 789 | ||
790 | /* | 790 | /* |
@@ -1475,7 +1475,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args, | |||
1475 | args->mount_server.addrlen = args->nfs_server.addrlen; | 1475 | args->mount_server.addrlen = args->nfs_server.addrlen; |
1476 | } | 1476 | } |
1477 | request.salen = args->mount_server.addrlen; | 1477 | request.salen = args->mount_server.addrlen; |
1478 | nfs_set_default_port(request.sap, args->mount_server.port, 0); | 1478 | nfs_set_port(request.sap, &args->mount_server.port, 0); |
1479 | 1479 | ||
1480 | /* | 1480 | /* |
1481 | * Now ask the mount server to map our export path | 1481 | * Now ask the mount server to map our export path |
@@ -1711,8 +1711,6 @@ static int nfs_validate_mount_data(void *options, | |||
1711 | 1711 | ||
1712 | if (!(data->flags & NFS_MOUNT_TCP)) | 1712 | if (!(data->flags & NFS_MOUNT_TCP)) |
1713 | args->nfs_server.protocol = XPRT_TRANSPORT_UDP; | 1713 | args->nfs_server.protocol = XPRT_TRANSPORT_UDP; |
1714 | else | ||
1715 | args->nfs_server.protocol = XPRT_TRANSPORT_TCP; | ||
1716 | /* N.B. caller will free nfs_server.hostname in all cases */ | 1714 | /* N.B. caller will free nfs_server.hostname in all cases */ |
1717 | args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); | 1715 | args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); |
1718 | args->namlen = data->namlen; | 1716 | args->namlen = data->namlen; |
@@ -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 | ||
@@ -1848,9 +1846,10 @@ nfs_compare_remount_data(struct nfs_server *nfss, | |||
1848 | data->acdirmin != nfss->acdirmin / HZ || | 1846 | data->acdirmin != nfss->acdirmin / HZ || |
1849 | data->acdirmax != nfss->acdirmax / HZ || | 1847 | data->acdirmax != nfss->acdirmax / HZ || |
1850 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || | 1848 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || |
1849 | data->nfs_server.port != nfss->port || | ||
1851 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || | 1850 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || |
1852 | memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr, | 1851 | !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, |
1853 | data->nfs_server.addrlen) != 0) | 1852 | (struct sockaddr *)&nfss->nfs_client->cl_addr)) |
1854 | return -EINVAL; | 1853 | return -EINVAL; |
1855 | 1854 | ||
1856 | return 0; | 1855 | return 0; |
@@ -1893,6 +1892,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) | |||
1893 | data->acdirmin = nfss->acdirmin / HZ; | 1892 | data->acdirmin = nfss->acdirmin / HZ; |
1894 | data->acdirmax = nfss->acdirmax / HZ; | 1893 | data->acdirmax = nfss->acdirmax / HZ; |
1895 | data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; | 1894 | data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; |
1895 | data->nfs_server.port = nfss->port; | ||
1896 | data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; | 1896 | data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; |
1897 | memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, | 1897 | memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, |
1898 | data->nfs_server.addrlen); | 1898 | data->nfs_server.addrlen); |
@@ -2106,7 +2106,7 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
2106 | }; | 2106 | }; |
2107 | int error = -ENOMEM; | 2107 | int error = -ENOMEM; |
2108 | 2108 | ||
2109 | data = nfs_alloc_parsed_mount_data(NFS_MOUNT_VER3 | NFS_MOUNT_TCP); | 2109 | data = nfs_alloc_parsed_mount_data(3); |
2110 | mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); | 2110 | mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); |
2111 | if (data == NULL || mntfh == NULL) | 2111 | if (data == NULL || mntfh == NULL) |
2112 | goto out_free_fh; | 2112 | goto out_free_fh; |
@@ -2331,7 +2331,7 @@ static int nfs4_validate_text_mount_data(void *options, | |||
2331 | { | 2331 | { |
2332 | struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; | 2332 | struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; |
2333 | 2333 | ||
2334 | nfs_set_default_port(sap, args->nfs_server.port, NFS_PORT); | 2334 | nfs_set_port(sap, &args->nfs_server.port, NFS_PORT); |
2335 | 2335 | ||
2336 | nfs_validate_transport_protocol(args); | 2336 | nfs_validate_transport_protocol(args); |
2337 | 2337 | ||
@@ -2376,7 +2376,6 @@ static int nfs4_validate_mount_data(void *options, | |||
2376 | if (data == NULL) | 2376 | if (data == NULL) |
2377 | goto out_no_data; | 2377 | goto out_no_data; |
2378 | 2378 | ||
2379 | args->version = 4; | ||
2380 | switch (data->version) { | 2379 | switch (data->version) { |
2381 | case 1: | 2380 | case 1: |
2382 | if (data->host_addrlen > sizeof(args->nfs_server.address)) | 2381 | if (data->host_addrlen > sizeof(args->nfs_server.address)) |
@@ -2660,7 +2659,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type, | |||
2660 | struct nfs_parsed_mount_data *data; | 2659 | struct nfs_parsed_mount_data *data; |
2661 | int error = -ENOMEM; | 2660 | int error = -ENOMEM; |
2662 | 2661 | ||
2663 | data = nfs_alloc_parsed_mount_data(0); | 2662 | data = nfs_alloc_parsed_mount_data(4); |
2664 | if (data == NULL) | 2663 | if (data == NULL) |
2665 | goto out_free_data; | 2664 | goto out_free_data; |
2666 | 2665 | ||
@@ -2690,7 +2689,6 @@ static void nfs4_kill_super(struct super_block *sb) | |||
2690 | dprintk("--> %s\n", __func__); | 2689 | dprintk("--> %s\n", __func__); |
2691 | nfs_super_return_all_delegations(sb); | 2690 | nfs_super_return_all_delegations(sb); |
2692 | kill_anon_super(sb); | 2691 | kill_anon_super(sb); |
2693 | nfs4_renewd_prepare_shutdown(server); | ||
2694 | nfs_fscache_release_super_cookie(sb); | 2692 | nfs_fscache_release_super_cookie(sb); |
2695 | nfs_free_server(server); | 2693 | nfs_free_server(server); |
2696 | dprintk("<-- %s\n", __func__); | 2694 | dprintk("<-- %s\n", __func__); |