SUNRPC: create unix gid cache per network namespace
v2: 1) fixed silly usage of template cache as a real one (this code left from static global cache for all) This patch makes unix_gid_cache cache detail allocated and registered per network namespace context. Thus with this patch unix_gid_cache contents for network namespace "X" are controlled from proc file system mount for the same network namespace "X". Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:

committed by
Trond Myklebust

parent
0a402d5a65
commit
73393232d6
@@ -26,6 +26,9 @@
|
||||
|
||||
int sunrpc_net_id;
|
||||
|
||||
extern int unix_gid_cache_create(struct net *net);
|
||||
extern int unix_gid_cache_destroy(struct net *net);
|
||||
|
||||
static __net_init int sunrpc_init_net(struct net *net)
|
||||
{
|
||||
int err;
|
||||
@@ -39,11 +42,17 @@ static __net_init int sunrpc_init_net(struct net *net)
|
||||
if (err)
|
||||
goto err_ipmap;
|
||||
|
||||
err = unix_gid_cache_create(net);
|
||||
if (err)
|
||||
goto err_unixgid;
|
||||
|
||||
rpc_pipefs_init_net(net);
|
||||
INIT_LIST_HEAD(&sn->all_clients);
|
||||
spin_lock_init(&sn->rpc_client_lock);
|
||||
return 0;
|
||||
|
||||
err_unixgid:
|
||||
ip_map_cache_destroy(net);
|
||||
err_ipmap:
|
||||
rpc_proc_exit(net);
|
||||
err_proc:
|
||||
@@ -52,6 +61,7 @@ err_proc:
|
||||
|
||||
static __net_exit void sunrpc_exit_net(struct net *net)
|
||||
{
|
||||
unix_gid_cache_destroy(net);
|
||||
ip_map_cache_destroy(net);
|
||||
rpc_proc_exit(net);
|
||||
}
|
||||
@@ -63,8 +73,6 @@ static struct pernet_operations sunrpc_net_ops = {
|
||||
.size = sizeof(struct sunrpc_net),
|
||||
};
|
||||
|
||||
extern struct cache_detail unix_gid_cache;
|
||||
|
||||
static int __init
|
||||
init_sunrpc(void)
|
||||
{
|
||||
@@ -86,7 +94,6 @@ init_sunrpc(void)
|
||||
#ifdef RPC_DEBUG
|
||||
rpc_register_sysctl();
|
||||
#endif
|
||||
cache_register(&unix_gid_cache);
|
||||
svc_init_xprt_sock(); /* svc sock transport */
|
||||
init_socket_xprt(); /* clnt sock transport */
|
||||
return 0;
|
||||
@@ -109,7 +116,6 @@ cleanup_sunrpc(void)
|
||||
svc_cleanup_xprt_sock();
|
||||
unregister_rpc_pipefs();
|
||||
rpc_destroy_mempool();
|
||||
cache_unregister(&unix_gid_cache);
|
||||
unregister_pernet_subsys(&sunrpc_net_ops);
|
||||
#ifdef RPC_DEBUG
|
||||
rpc_unregister_sysctl();
|
||||
|
Reference in New Issue
Block a user