aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/client.c2
-rw-r--r--fs/nfs/nfs4namespace.c12
-rw-r--r--fs/nfs/nfs4renewd.c6
-rw-r--r--fs/nfs/super.c37
4 files changed, 25 insertions, 32 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 63976c0ccc25..99ea196f071f 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1180,7 +1180,7 @@ static int nfs4_init_client(struct nfs_client *clp,
1180 1, flags & NFS_MOUNT_NORESVPORT); 1180 1, flags & NFS_MOUNT_NORESVPORT);
1181 if (error < 0) 1181 if (error < 0)
1182 goto error; 1182 goto error;
1183 memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); 1183 strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
1184 1184
1185 error = nfs_idmap_new(clp); 1185 error = nfs_idmap_new(clp);
1186 if (error < 0) { 1186 if (error < 0) {
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 2636c26d56fa..fa3408f20112 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -121,7 +121,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
121 121
122 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); 122 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE);
123 if (IS_ERR(mnt_path)) 123 if (IS_ERR(mnt_path))
124 return mnt; 124 return ERR_CAST(mnt_path);
125 mountdata->mnt_path = mnt_path; 125 mountdata->mnt_path = mnt_path;
126 maxbuflen = mnt_path - 1 - page2; 126 maxbuflen = mnt_path - 1 - page2;
127 127
@@ -132,15 +132,15 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
132 if (buf->len <= 0 || buf->len >= maxbuflen) 132 if (buf->len <= 0 || buf->len >= maxbuflen)
133 continue; 133 continue;
134 134
135 mountdata->addr = (struct sockaddr *)&addr;
136
137 if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) 135 if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len))
138 continue; 136 continue;
139 mountdata->addrlen = nfs_parse_server_name(buf->data, 137
140 buf->len, 138 mountdata->addrlen = nfs_parse_server_name(buf->data, buf->len,
141 mountdata->addr, mountdata->addrlen); 139 (struct sockaddr *)&addr, sizeof(addr));
142 if (mountdata->addrlen == 0) 140 if (mountdata->addrlen == 0)
143 continue; 141 continue;
142
143 mountdata->addr = (struct sockaddr *)&addr;
144 rpc_set_port(mountdata->addr, NFS_PORT); 144 rpc_set_port(mountdata->addr, NFS_PORT);
145 145
146 memcpy(page2, buf->data, buf->len); 146 memcpy(page2, buf->data, buf->len);
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index e27c6cef18f2..0156c01c212c 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -127,12 +127,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
127} 127}
128 128
129void 129void
130nfs4_renewd_prepare_shutdown(struct nfs_server *server)
131{
132 cancel_delayed_work(&server->nfs_client->cl_renewd);
133}
134
135void
136nfs4_kill_renewd(struct nfs_client *clp) 130nfs4_kill_renewd(struct nfs_client *clp)
137{ 131{
138 cancel_delayed_work_sync(&clp->cl_renewd); 132 cancel_delayed_work_sync(&clp->cl_renewd);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 29786d3b9326..90be551b80c1 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
731static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(int flags) 731static 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 */
779static void nfs_set_default_port(struct sockaddr *sap, const int parsed_port, 781static 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/*
@@ -1253,6 +1253,7 @@ static int nfs_parse_mount_options(char *raw,
1253 default: 1253 default:
1254 dfprintk(MOUNT, "NFS: unrecognized " 1254 dfprintk(MOUNT, "NFS: unrecognized "
1255 "transport protocol\n"); 1255 "transport protocol\n");
1256 kfree(string);
1256 return 0; 1257 return 0;
1257 } 1258 }
1258 break; 1259 break;
@@ -1475,7 +1476,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
1475 args->mount_server.addrlen = args->nfs_server.addrlen; 1476 args->mount_server.addrlen = args->nfs_server.addrlen;
1476 } 1477 }
1477 request.salen = args->mount_server.addrlen; 1478 request.salen = args->mount_server.addrlen;
1478 nfs_set_default_port(request.sap, args->mount_server.port, 0); 1479 nfs_set_port(request.sap, &args->mount_server.port, 0);
1479 1480
1480 /* 1481 /*
1481 * Now ask the mount server to map our export path 1482 * Now ask the mount server to map our export path
@@ -1711,8 +1712,6 @@ static int nfs_validate_mount_data(void *options,
1711 1712
1712 if (!(data->flags & NFS_MOUNT_TCP)) 1713 if (!(data->flags & NFS_MOUNT_TCP))
1713 args->nfs_server.protocol = XPRT_TRANSPORT_UDP; 1714 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 */ 1715 /* N.B. caller will free nfs_server.hostname in all cases */
1717 args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); 1716 args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
1718 args->namlen = data->namlen; 1717 args->namlen = data->namlen;
@@ -1767,7 +1766,7 @@ static int nfs_validate_mount_data(void *options,
1767 goto out_v4_not_compiled; 1766 goto out_v4_not_compiled;
1768#endif 1767#endif
1769 1768
1770 nfs_set_default_port(sap, args->nfs_server.port, 0); 1769 nfs_set_port(sap, &args->nfs_server.port, 0);
1771 1770
1772 nfs_set_mount_transport_protocol(args); 1771 nfs_set_mount_transport_protocol(args);
1773 1772
@@ -1848,9 +1847,10 @@ nfs_compare_remount_data(struct nfs_server *nfss,
1848 data->acdirmin != nfss->acdirmin / HZ || 1847 data->acdirmin != nfss->acdirmin / HZ ||
1849 data->acdirmax != nfss->acdirmax / HZ || 1848 data->acdirmax != nfss->acdirmax / HZ ||
1850 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || 1849 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
1850 data->nfs_server.port != nfss->port ||
1851 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || 1851 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
1852 memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr, 1852 !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address,
1853 data->nfs_server.addrlen) != 0) 1853 (struct sockaddr *)&nfss->nfs_client->cl_addr))
1854 return -EINVAL; 1854 return -EINVAL;
1855 1855
1856 return 0; 1856 return 0;
@@ -1893,6 +1893,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
1893 data->acdirmin = nfss->acdirmin / HZ; 1893 data->acdirmin = nfss->acdirmin / HZ;
1894 data->acdirmax = nfss->acdirmax / HZ; 1894 data->acdirmax = nfss->acdirmax / HZ;
1895 data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; 1895 data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
1896 data->nfs_server.port = nfss->port;
1896 data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; 1897 data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
1897 memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, 1898 memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
1898 data->nfs_server.addrlen); 1899 data->nfs_server.addrlen);
@@ -2106,7 +2107,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
2106 }; 2107 };
2107 int error = -ENOMEM; 2108 int error = -ENOMEM;
2108 2109
2109 data = nfs_alloc_parsed_mount_data(NFS_MOUNT_VER3 | NFS_MOUNT_TCP); 2110 data = nfs_alloc_parsed_mount_data(3);
2110 mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); 2111 mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
2111 if (data == NULL || mntfh == NULL) 2112 if (data == NULL || mntfh == NULL)
2112 goto out_free_fh; 2113 goto out_free_fh;
@@ -2331,7 +2332,7 @@ static int nfs4_validate_text_mount_data(void *options,
2331{ 2332{
2332 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; 2333 struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
2333 2334
2334 nfs_set_default_port(sap, args->nfs_server.port, NFS_PORT); 2335 nfs_set_port(sap, &args->nfs_server.port, NFS_PORT);
2335 2336
2336 nfs_validate_transport_protocol(args); 2337 nfs_validate_transport_protocol(args);
2337 2338
@@ -2376,7 +2377,6 @@ static int nfs4_validate_mount_data(void *options,
2376 if (data == NULL) 2377 if (data == NULL)
2377 goto out_no_data; 2378 goto out_no_data;
2378 2379
2379 args->version = 4;
2380 switch (data->version) { 2380 switch (data->version) {
2381 case 1: 2381 case 1:
2382 if (data->host_addrlen > sizeof(args->nfs_server.address)) 2382 if (data->host_addrlen > sizeof(args->nfs_server.address))
@@ -2660,7 +2660,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
2660 struct nfs_parsed_mount_data *data; 2660 struct nfs_parsed_mount_data *data;
2661 int error = -ENOMEM; 2661 int error = -ENOMEM;
2662 2662
2663 data = nfs_alloc_parsed_mount_data(0); 2663 data = nfs_alloc_parsed_mount_data(4);
2664 if (data == NULL) 2664 if (data == NULL)
2665 goto out_free_data; 2665 goto out_free_data;
2666 2666
@@ -2690,7 +2690,6 @@ static void nfs4_kill_super(struct super_block *sb)
2690 dprintk("--> %s\n", __func__); 2690 dprintk("--> %s\n", __func__);
2691 nfs_super_return_all_delegations(sb); 2691 nfs_super_return_all_delegations(sb);
2692 kill_anon_super(sb); 2692 kill_anon_super(sb);
2693 nfs4_renewd_prepare_shutdown(server);
2694 nfs_fscache_release_super_cookie(sb); 2693 nfs_fscache_release_super_cookie(sb);
2695 nfs_free_server(server); 2694 nfs_free_server(server);
2696 dprintk("<-- %s\n", __func__); 2695 dprintk("<-- %s\n", __func__);