Commit a1db410d authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust

SUNRPC: create GSS auth cache per network namespace

This patch makes GSS auth cache details allocated and registered per network
namespace context.
Thus with this patch rsi_cache and rsc_cache contents for network namespace "X"
are controlled from proc file system mount for the same network namespace "X".
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 73393232
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
int gss_svc_init(void); int gss_svc_init(void);
void gss_svc_shutdown(void); void gss_svc_shutdown(void);
int gss_svc_init_net(struct net *net);
void gss_svc_shutdown_net(struct net *net);
int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
u32 svcauth_gss_flavor(struct auth_domain *dom); u32 svcauth_gss_flavor(struct auth_domain *dom);
char *svc_gss_principal(struct svc_rqst *); char *svc_gss_principal(struct svc_rqst *);
......
...@@ -1662,6 +1662,21 @@ static const struct rpc_pipe_ops gss_upcall_ops_v1 = { ...@@ -1662,6 +1662,21 @@ static const struct rpc_pipe_ops gss_upcall_ops_v1 = {
.release_pipe = gss_pipe_release, .release_pipe = gss_pipe_release,
}; };
static __net_init int rpcsec_gss_init_net(struct net *net)
{
return gss_svc_init_net(net);
}
static __net_exit void rpcsec_gss_exit_net(struct net *net)
{
gss_svc_shutdown_net(net);
}
static struct pernet_operations rpcsec_gss_net_ops = {
.init = rpcsec_gss_init_net,
.exit = rpcsec_gss_exit_net,
};
/* /*
* Initialize RPCSEC_GSS module * Initialize RPCSEC_GSS module
*/ */
...@@ -1675,8 +1690,13 @@ static int __init init_rpcsec_gss(void) ...@@ -1675,8 +1690,13 @@ static int __init init_rpcsec_gss(void)
err = gss_svc_init(); err = gss_svc_init();
if (err) if (err)
goto out_unregister; goto out_unregister;
err = register_pernet_subsys(&rpcsec_gss_net_ops);
if (err)
goto out_svc_exit;
rpc_init_wait_queue(&pipe_version_rpc_waitqueue, "gss pipe version"); rpc_init_wait_queue(&pipe_version_rpc_waitqueue, "gss pipe version");
return 0; return 0;
out_svc_exit:
gss_svc_shutdown();
out_unregister: out_unregister:
rpcauth_unregister(&authgss_ops); rpcauth_unregister(&authgss_ops);
out: out:
...@@ -1685,6 +1705,7 @@ static int __init init_rpcsec_gss(void) ...@@ -1685,6 +1705,7 @@ static int __init init_rpcsec_gss(void)
static void __exit exit_rpcsec_gss(void) static void __exit exit_rpcsec_gss(void)
{ {
unregister_pernet_subsys(&rpcsec_gss_net_ops);
gss_svc_shutdown(); gss_svc_shutdown();
rpcauth_unregister(&authgss_ops); rpcauth_unregister(&authgss_ops);
rcu_barrier(); /* Wait for completion of call_rcu()'s */ rcu_barrier(); /* Wait for completion of call_rcu()'s */
......
This diff is collapsed.
...@@ -10,6 +10,8 @@ struct sunrpc_net { ...@@ -10,6 +10,8 @@ struct sunrpc_net {
struct proc_dir_entry *proc_net_rpc; struct proc_dir_entry *proc_net_rpc;
struct cache_detail *ip_map_cache; struct cache_detail *ip_map_cache;
struct cache_detail *unix_gid_cache; struct cache_detail *unix_gid_cache;
struct cache_detail *rsc_cache;
struct cache_detail *rsi_cache;
struct super_block *pipefs_sb; struct super_block *pipefs_sb;
struct mutex pipefs_sb_lock; struct mutex pipefs_sb_lock;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "netns.h" #include "netns.h"
int sunrpc_net_id; int sunrpc_net_id;
EXPORT_SYMBOL_GPL(sunrpc_net_id);
extern int unix_gid_cache_create(struct net *net); extern int unix_gid_cache_create(struct net *net);
extern int unix_gid_cache_destroy(struct net *net); extern int unix_gid_cache_destroy(struct net *net);
......
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