diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-10 07:12:46 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 18:20:26 -0500 |
commit | e50a7a1a42335243c94eeea4a8d23413cb02370d (patch) | |
tree | 070a312c2adfce384b64083b8ae204b4d47ffba9 /fs/nfs/client.c | |
parent | ad6b134008f4e765dd19976552b929273ae523bd (diff) |
NFS: make NFS client allocated per network namespace context
This patch adds new net variable to nfs_client structure. This variable is set
on NFS client creation and cheched during matching NFS client search.
Initially current->nsproxy->net_ns is used as network namespace owner for new
NFS client to create. This network namespace pointer is set during mount
options parsing and thus can be passed from user-spave utils in future if will
be necessary.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 31778f74357d..ca016fe44602 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -135,6 +135,7 @@ struct nfs_client_initdata { | |||
135 | const struct nfs_rpc_ops *rpc_ops; | 135 | const struct nfs_rpc_ops *rpc_ops; |
136 | int proto; | 136 | int proto; |
137 | u32 minorversion; | 137 | u32 minorversion; |
138 | struct net *net; | ||
138 | }; | 139 | }; |
139 | 140 | ||
140 | /* | 141 | /* |
@@ -189,6 +190,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ | |||
189 | if (!IS_ERR(cred)) | 190 | if (!IS_ERR(cred)) |
190 | clp->cl_machine_cred = cred; | 191 | clp->cl_machine_cred = cred; |
191 | nfs_fscache_get_client_cookie(clp); | 192 | nfs_fscache_get_client_cookie(clp); |
193 | clp->net = cl_init->net; | ||
192 | 194 | ||
193 | return clp; | 195 | return clp; |
194 | 196 | ||
@@ -481,6 +483,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat | |||
481 | /* Match the full socket address */ | 483 | /* Match the full socket address */ |
482 | if (!nfs_sockaddr_cmp(sap, clap)) | 484 | if (!nfs_sockaddr_cmp(sap, clap)) |
483 | continue; | 485 | continue; |
486 | /* Match network namespace */ | ||
487 | if (clp->net != data->net) | ||
488 | continue; | ||
484 | 489 | ||
485 | atomic_inc(&clp->cl_count); | 490 | atomic_inc(&clp->cl_count); |
486 | return clp; | 491 | return clp; |
@@ -831,6 +836,7 @@ static int nfs_init_server(struct nfs_server *server, | |||
831 | .addrlen = data->nfs_server.addrlen, | 836 | .addrlen = data->nfs_server.addrlen, |
832 | .rpc_ops = &nfs_v2_clientops, | 837 | .rpc_ops = &nfs_v2_clientops, |
833 | .proto = data->nfs_server.protocol, | 838 | .proto = data->nfs_server.protocol, |
839 | .net = data->net, | ||
834 | }; | 840 | }; |
835 | struct rpc_timeout timeparms; | 841 | struct rpc_timeout timeparms; |
836 | struct nfs_client *clp; | 842 | struct nfs_client *clp; |
@@ -1393,7 +1399,7 @@ static int nfs4_set_client(struct nfs_server *server, | |||
1393 | const char *ip_addr, | 1399 | const char *ip_addr, |
1394 | rpc_authflavor_t authflavour, | 1400 | rpc_authflavor_t authflavour, |
1395 | int proto, const struct rpc_timeout *timeparms, | 1401 | int proto, const struct rpc_timeout *timeparms, |
1396 | u32 minorversion) | 1402 | u32 minorversion, struct net *net) |
1397 | { | 1403 | { |
1398 | struct nfs_client_initdata cl_init = { | 1404 | struct nfs_client_initdata cl_init = { |
1399 | .hostname = hostname, | 1405 | .hostname = hostname, |
@@ -1402,6 +1408,7 @@ static int nfs4_set_client(struct nfs_server *server, | |||
1402 | .rpc_ops = &nfs_v4_clientops, | 1408 | .rpc_ops = &nfs_v4_clientops, |
1403 | .proto = proto, | 1409 | .proto = proto, |
1404 | .minorversion = minorversion, | 1410 | .minorversion = minorversion, |
1411 | .net = net, | ||
1405 | }; | 1412 | }; |
1406 | struct nfs_client *clp; | 1413 | struct nfs_client *clp; |
1407 | int error; | 1414 | int error; |
@@ -1453,6 +1460,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, | |||
1453 | .rpc_ops = &nfs_v4_clientops, | 1460 | .rpc_ops = &nfs_v4_clientops, |
1454 | .proto = ds_proto, | 1461 | .proto = ds_proto, |
1455 | .minorversion = mds_clp->cl_minorversion, | 1462 | .minorversion = mds_clp->cl_minorversion, |
1463 | .net = mds_clp->net, | ||
1456 | }; | 1464 | }; |
1457 | struct rpc_timeout ds_timeout = { | 1465 | struct rpc_timeout ds_timeout = { |
1458 | .to_initval = 15 * HZ, | 1466 | .to_initval = 15 * HZ, |
@@ -1580,7 +1588,8 @@ static int nfs4_init_server(struct nfs_server *server, | |||
1580 | data->auth_flavors[0], | 1588 | data->auth_flavors[0], |
1581 | data->nfs_server.protocol, | 1589 | data->nfs_server.protocol, |
1582 | &timeparms, | 1590 | &timeparms, |
1583 | data->minorversion); | 1591 | data->minorversion, |
1592 | data->net); | ||
1584 | if (error < 0) | 1593 | if (error < 0) |
1585 | goto error; | 1594 | goto error; |
1586 | 1595 | ||
@@ -1677,7 +1686,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, | |||
1677 | data->authflavor, | 1686 | data->authflavor, |
1678 | parent_server->client->cl_xprt->prot, | 1687 | parent_server->client->cl_xprt->prot, |
1679 | parent_server->client->cl_timeout, | 1688 | parent_server->client->cl_timeout, |
1680 | parent_client->cl_mvops->minor_version); | 1689 | parent_client->cl_mvops->minor_version, |
1690 | parent_client->net); | ||
1681 | if (error < 0) | 1691 | if (error < 0) |
1682 | goto error; | 1692 | goto error; |
1683 | 1693 | ||