Commit 32b7a567 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  NFSv4: Kill nfs4_renewd_prepare_shutdown()
  NFSv4: Fix the referral mount code
  nfs: Avoid overrun when copying client IP address string
  NFS: Fix port initialisation in nfs_remount()
  NFS: Fix port and mountport display in /proc/self/mountinfo
  NFS: Fix a default mount regression...
parents 36a07902 3050141b
...@@ -1180,7 +1180,7 @@ static int nfs4_init_client(struct nfs_client *clp, ...@@ -1180,7 +1180,7 @@ static int nfs4_init_client(struct nfs_client *clp,
1, flags & NFS_MOUNT_NORESVPORT); 1, flags & NFS_MOUNT_NORESVPORT);
if (error < 0) if (error < 0)
goto error; goto error;
memcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr)); strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
error = nfs_idmap_new(clp); error = nfs_idmap_new(clp);
if (error < 0) { if (error < 0) {
......
...@@ -121,7 +121,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, ...@@ -121,7 +121,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE);
if (IS_ERR(mnt_path)) if (IS_ERR(mnt_path))
return mnt; return ERR_CAST(mnt_path);
mountdata->mnt_path = mnt_path; mountdata->mnt_path = mnt_path;
maxbuflen = mnt_path - 1 - page2; maxbuflen = mnt_path - 1 - page2;
...@@ -132,15 +132,15 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, ...@@ -132,15 +132,15 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
if (buf->len <= 0 || buf->len >= maxbuflen) if (buf->len <= 0 || buf->len >= maxbuflen)
continue; continue;
mountdata->addr = (struct sockaddr *)&addr;
if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len))
continue; continue;
mountdata->addrlen = nfs_parse_server_name(buf->data,
buf->len, mountdata->addrlen = nfs_parse_server_name(buf->data, buf->len,
mountdata->addr, mountdata->addrlen); (struct sockaddr *)&addr, sizeof(addr));
if (mountdata->addrlen == 0) if (mountdata->addrlen == 0)
continue; continue;
mountdata->addr = (struct sockaddr *)&addr;
rpc_set_port(mountdata->addr, NFS_PORT); rpc_set_port(mountdata->addr, NFS_PORT);
memcpy(page2, buf->data, buf->len); memcpy(page2, buf->data, buf->len);
......
...@@ -126,12 +126,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp) ...@@ -126,12 +126,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
} }
void
nfs4_renewd_prepare_shutdown(struct nfs_server *server)
{
cancel_delayed_work(&server->nfs_client->cl_renewd);
}
void void
nfs4_kill_renewd(struct nfs_client *clp) nfs4_kill_renewd(struct nfs_client *clp)
{ {
......
...@@ -728,22 +728,24 @@ static void nfs_umount_begin(struct super_block *sb) ...@@ -728,22 +728,24 @@ static void nfs_umount_begin(struct super_block *sb)
unlock_kernel(); unlock_kernel();
} }
static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(int flags) static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int version)
{ {
struct nfs_parsed_mount_data *data; struct nfs_parsed_mount_data *data;
data = kzalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (data) { if (data) {
data->flags = flags;
data->rsize = NFS_MAX_FILE_IO_SIZE; data->rsize = NFS_MAX_FILE_IO_SIZE;
data->wsize = NFS_MAX_FILE_IO_SIZE; data->wsize = NFS_MAX_FILE_IO_SIZE;
data->acregmin = NFS_DEF_ACREGMIN; data->acregmin = NFS_DEF_ACREGMIN;
data->acregmax = NFS_DEF_ACREGMAX; data->acregmax = NFS_DEF_ACREGMAX;
data->acdirmin = NFS_DEF_ACDIRMIN; data->acdirmin = NFS_DEF_ACDIRMIN;
data->acdirmax = NFS_DEF_ACDIRMAX; data->acdirmax = NFS_DEF_ACDIRMAX;
data->mount_server.port = NFS_UNSPEC_PORT;
data->nfs_server.port = NFS_UNSPEC_PORT; data->nfs_server.port = NFS_UNSPEC_PORT;
data->nfs_server.protocol = XPRT_TRANSPORT_TCP;
data->auth_flavors[0] = RPC_AUTH_UNIX; data->auth_flavors[0] = RPC_AUTH_UNIX;
data->auth_flavor_len = 1; data->auth_flavor_len = 1;
data->version = version;
data->minorversion = 0; data->minorversion = 0;
} }
return data; return data;
...@@ -776,15 +778,13 @@ static int nfs_verify_server_address(struct sockaddr *addr) ...@@ -776,15 +778,13 @@ static int nfs_verify_server_address(struct sockaddr *addr)
* Select between a default port value and a user-specified port value. * Select between a default port value and a user-specified port value.
* If a zero value is set, then autobind will be used. * If a zero value is set, then autobind will be used.
*/ */
static void nfs_set_default_port(struct sockaddr *sap, const int parsed_port, static void nfs_set_port(struct sockaddr *sap, int *port,
const unsigned short default_port) const unsigned short default_port)
{ {
unsigned short port = default_port; if (*port == NFS_UNSPEC_PORT)
*port = default_port;
if (parsed_port != NFS_UNSPEC_PORT) rpc_set_port(sap, *port);
port = parsed_port;
rpc_set_port(sap, port);
} }
/* /*
...@@ -1475,7 +1475,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args, ...@@ -1475,7 +1475,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
args->mount_server.addrlen = args->nfs_server.addrlen; args->mount_server.addrlen = args->nfs_server.addrlen;
} }
request.salen = args->mount_server.addrlen; request.salen = args->mount_server.addrlen;
nfs_set_default_port(request.sap, args->mount_server.port, 0); nfs_set_port(request.sap, &args->mount_server.port, 0);
/* /*
* Now ask the mount server to map our export path * Now ask the mount server to map our export path
...@@ -1711,8 +1711,6 @@ static int nfs_validate_mount_data(void *options, ...@@ -1711,8 +1711,6 @@ static int nfs_validate_mount_data(void *options,
if (!(data->flags & NFS_MOUNT_TCP)) if (!(data->flags & NFS_MOUNT_TCP))
args->nfs_server.protocol = XPRT_TRANSPORT_UDP; args->nfs_server.protocol = XPRT_TRANSPORT_UDP;
else
args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
/* N.B. caller will free nfs_server.hostname in all cases */ /* N.B. caller will free nfs_server.hostname in all cases */
args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
args->namlen = data->namlen; args->namlen = data->namlen;
...@@ -1767,7 +1765,7 @@ static int nfs_validate_mount_data(void *options, ...@@ -1767,7 +1765,7 @@ static int nfs_validate_mount_data(void *options,
goto out_v4_not_compiled; goto out_v4_not_compiled;
#endif #endif
nfs_set_default_port(sap, args->nfs_server.port, 0); nfs_set_port(sap, &args->nfs_server.port, 0);
nfs_set_mount_transport_protocol(args); nfs_set_mount_transport_protocol(args);
...@@ -1848,9 +1846,10 @@ nfs_compare_remount_data(struct nfs_server *nfss, ...@@ -1848,9 +1846,10 @@ nfs_compare_remount_data(struct nfs_server *nfss,
data->acdirmin != nfss->acdirmin / HZ || data->acdirmin != nfss->acdirmin / HZ ||
data->acdirmax != nfss->acdirmax / HZ || data->acdirmax != nfss->acdirmax / HZ ||
data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
data->nfs_server.port != nfss->port ||
data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr, !rpc_cmp_addr(&data->nfs_server.address,
data->nfs_server.addrlen) != 0) &nfss->nfs_client->cl_addr))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1893,6 +1892,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) ...@@ -1893,6 +1892,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
data->acdirmin = nfss->acdirmin / HZ; data->acdirmin = nfss->acdirmin / HZ;
data->acdirmax = nfss->acdirmax / HZ; data->acdirmax = nfss->acdirmax / HZ;
data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
data->nfs_server.port = nfss->port;
data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr, memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
data->nfs_server.addrlen); data->nfs_server.addrlen);
...@@ -2106,7 +2106,7 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -2106,7 +2106,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
}; };
int error = -ENOMEM; int error = -ENOMEM;
data = nfs_alloc_parsed_mount_data(NFS_MOUNT_VER3 | NFS_MOUNT_TCP); data = nfs_alloc_parsed_mount_data(3);
mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
if (data == NULL || mntfh == NULL) if (data == NULL || mntfh == NULL)
goto out_free_fh; goto out_free_fh;
...@@ -2331,7 +2331,7 @@ static int nfs4_validate_text_mount_data(void *options, ...@@ -2331,7 +2331,7 @@ static int nfs4_validate_text_mount_data(void *options,
{ {
struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address; struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
nfs_set_default_port(sap, args->nfs_server.port, NFS_PORT); nfs_set_port(sap, &args->nfs_server.port, NFS_PORT);
nfs_validate_transport_protocol(args); nfs_validate_transport_protocol(args);
...@@ -2376,7 +2376,6 @@ static int nfs4_validate_mount_data(void *options, ...@@ -2376,7 +2376,6 @@ static int nfs4_validate_mount_data(void *options,
if (data == NULL) if (data == NULL)
goto out_no_data; goto out_no_data;
args->version = 4;
switch (data->version) { switch (data->version) {
case 1: case 1:
if (data->host_addrlen > sizeof(args->nfs_server.address)) 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,7 +2659,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
struct nfs_parsed_mount_data *data; struct nfs_parsed_mount_data *data;
int error = -ENOMEM; int error = -ENOMEM;
data = nfs_alloc_parsed_mount_data(0); data = nfs_alloc_parsed_mount_data(4);
if (data == NULL) if (data == NULL)
goto out_free_data; goto out_free_data;
...@@ -2690,7 +2689,6 @@ static void nfs4_kill_super(struct super_block *sb) ...@@ -2690,7 +2689,6 @@ static void nfs4_kill_super(struct super_block *sb)
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
nfs_super_return_all_delegations(sb); nfs_super_return_all_delegations(sb);
kill_anon_super(sb); kill_anon_super(sb);
nfs4_renewd_prepare_shutdown(server);
nfs_fscache_release_super_cookie(sb); nfs_fscache_release_super_cookie(sb);
nfs_free_server(server); nfs_free_server(server);
dprintk("<-- %s\n", __func__); dprintk("<-- %s\n", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment