|
@@ -481,7 +481,12 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
|
|
* Look up a client by IP address and protocol version
|
|
* Look up a client by IP address and protocol version
|
|
* - creates a new record if one doesn't yet exist
|
|
* - creates a new record if one doesn't yet exist
|
|
*/
|
|
*/
|
|
-static struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init)
|
|
|
|
|
|
+static struct nfs_client *
|
|
|
|
+nfs_get_client(const struct nfs_client_initdata *cl_init,
|
|
|
|
+ const struct rpc_timeout *timeparms,
|
|
|
|
+ const char *ip_addr,
|
|
|
|
+ rpc_authflavor_t authflavour,
|
|
|
|
+ int noresvport)
|
|
{
|
|
{
|
|
struct nfs_client *clp, *new = NULL;
|
|
struct nfs_client *clp, *new = NULL;
|
|
int error;
|
|
int error;
|
|
@@ -512,6 +517,13 @@ install_client:
|
|
clp = new;
|
|
clp = new;
|
|
list_add(&clp->cl_share_link, &nfs_client_list);
|
|
list_add(&clp->cl_share_link, &nfs_client_list);
|
|
spin_unlock(&nfs_client_lock);
|
|
spin_unlock(&nfs_client_lock);
|
|
|
|
+
|
|
|
|
+ error = cl_init->rpc_ops->init_client(clp, timeparms, ip_addr,
|
|
|
|
+ authflavour, noresvport);
|
|
|
|
+ if (error < 0) {
|
|
|
|
+ nfs_put_client(clp);
|
|
|
|
+ return ERR_PTR(error);
|
|
|
|
+ }
|
|
dprintk("--> nfs_get_client() = %p [new]\n", clp);
|
|
dprintk("--> nfs_get_client() = %p [new]\n", clp);
|
|
return clp;
|
|
return clp;
|
|
|
|
|
|
@@ -767,9 +779,9 @@ static int nfs_init_server_rpcclient(struct nfs_server *server,
|
|
/*
|
|
/*
|
|
* Initialise an NFS2 or NFS3 client
|
|
* Initialise an NFS2 or NFS3 client
|
|
*/
|
|
*/
|
|
-static int nfs_init_client(struct nfs_client *clp,
|
|
|
|
- const struct rpc_timeout *timeparms,
|
|
|
|
- const struct nfs_parsed_mount_data *data)
|
|
|
|
|
|
+int nfs_init_client(struct nfs_client *clp, const struct rpc_timeout *timeparms,
|
|
|
|
+ const char *ip_addr, rpc_authflavor_t authflavour,
|
|
|
|
+ int noresvport)
|
|
{
|
|
{
|
|
int error;
|
|
int error;
|
|
|
|
|
|
@@ -784,7 +796,7 @@ static int nfs_init_client(struct nfs_client *clp,
|
|
* - RFC 2623, sec 2.3.2
|
|
* - RFC 2623, sec 2.3.2
|
|
*/
|
|
*/
|
|
error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX,
|
|
error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX,
|
|
- 0, data->flags & NFS_MOUNT_NORESVPORT);
|
|
|
|
|
|
+ 0, noresvport);
|
|
if (error < 0)
|
|
if (error < 0)
|
|
goto error;
|
|
goto error;
|
|
nfs_mark_client_ready(clp, NFS_CS_READY);
|
|
nfs_mark_client_ready(clp, NFS_CS_READY);
|
|
@@ -820,19 +832,17 @@ static int nfs_init_server(struct nfs_server *server,
|
|
cl_init.rpc_ops = &nfs_v3_clientops;
|
|
cl_init.rpc_ops = &nfs_v3_clientops;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ nfs_init_timeout_values(&timeparms, data->nfs_server.protocol,
|
|
|
|
+ data->timeo, data->retrans);
|
|
|
|
+
|
|
/* Allocate or find a client reference we can use */
|
|
/* Allocate or find a client reference we can use */
|
|
- clp = nfs_get_client(&cl_init);
|
|
|
|
|
|
+ clp = nfs_get_client(&cl_init, &timeparms, NULL, RPC_AUTH_UNIX,
|
|
|
|
+ data->flags & NFS_MOUNT_NORESVPORT);
|
|
if (IS_ERR(clp)) {
|
|
if (IS_ERR(clp)) {
|
|
dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
|
|
dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
|
|
return PTR_ERR(clp);
|
|
return PTR_ERR(clp);
|
|
}
|
|
}
|
|
|
|
|
|
- nfs_init_timeout_values(&timeparms, data->nfs_server.protocol,
|
|
|
|
- data->timeo, data->retrans);
|
|
|
|
- error = nfs_init_client(clp, &timeparms, data);
|
|
|
|
- if (error < 0)
|
|
|
|
- goto error;
|
|
|
|
-
|
|
|
|
server->nfs_client = clp;
|
|
server->nfs_client = clp;
|
|
|
|
|
|
/* Initialise the client representation from the mount data */
|
|
/* Initialise the client representation from the mount data */
|
|
@@ -1307,11 +1317,11 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp)
|
|
/*
|
|
/*
|
|
* Initialise an NFS4 client record
|
|
* Initialise an NFS4 client record
|
|
*/
|
|
*/
|
|
-static int nfs4_init_client(struct nfs_client *clp,
|
|
|
|
- const struct rpc_timeout *timeparms,
|
|
|
|
- const char *ip_addr,
|
|
|
|
- rpc_authflavor_t authflavour,
|
|
|
|
- int flags)
|
|
|
|
|
|
+int nfs4_init_client(struct nfs_client *clp,
|
|
|
|
+ const struct rpc_timeout *timeparms,
|
|
|
|
+ const char *ip_addr,
|
|
|
|
+ rpc_authflavor_t authflavour,
|
|
|
|
+ int noresvport)
|
|
{
|
|
{
|
|
int error;
|
|
int error;
|
|
|
|
|
|
@@ -1325,7 +1335,7 @@ static int nfs4_init_client(struct nfs_client *clp,
|
|
clp->rpc_ops = &nfs_v4_clientops;
|
|
clp->rpc_ops = &nfs_v4_clientops;
|
|
|
|
|
|
error = nfs_create_rpc_client(clp, timeparms, authflavour,
|
|
error = nfs_create_rpc_client(clp, timeparms, authflavour,
|
|
- 1, flags & NFS_MOUNT_NORESVPORT);
|
|
|
|
|
|
+ 1, noresvport);
|
|
if (error < 0)
|
|
if (error < 0)
|
|
goto error;
|
|
goto error;
|
|
strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
|
|
strlcpy(clp->cl_ipaddr, ip_addr, sizeof(clp->cl_ipaddr));
|
|
@@ -1378,22 +1388,16 @@ static int nfs4_set_client(struct nfs_server *server,
|
|
dprintk("--> nfs4_set_client()\n");
|
|
dprintk("--> nfs4_set_client()\n");
|
|
|
|
|
|
/* Allocate or find a client reference we can use */
|
|
/* Allocate or find a client reference we can use */
|
|
- clp = nfs_get_client(&cl_init);
|
|
|
|
|
|
+ clp = nfs_get_client(&cl_init, timeparms, ip_addr, authflavour,
|
|
|
|
+ server->flags & NFS_MOUNT_NORESVPORT);
|
|
if (IS_ERR(clp)) {
|
|
if (IS_ERR(clp)) {
|
|
error = PTR_ERR(clp);
|
|
error = PTR_ERR(clp);
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
- error = nfs4_init_client(clp, timeparms, ip_addr, authflavour,
|
|
|
|
- server->flags);
|
|
|
|
- if (error < 0)
|
|
|
|
- goto error_put;
|
|
|
|
|
|
|
|
server->nfs_client = clp;
|
|
server->nfs_client = clp;
|
|
dprintk("<-- nfs4_set_client() = 0 [new %p]\n", clp);
|
|
dprintk("<-- nfs4_set_client() = 0 [new %p]\n", clp);
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
-error_put:
|
|
|
|
- nfs_put_client(clp);
|
|
|
|
error:
|
|
error:
|
|
dprintk("<-- nfs4_set_client() = xerror %d\n", error);
|
|
dprintk("<-- nfs4_set_client() = xerror %d\n", error);
|
|
return error;
|
|
return error;
|