NFSd: use network-namespace-aware cache registering routines

v2: cache_register_net() and cache_unregister_net() GPL exports added

This is a cleanup patch. Hope, some day generic cache_register() and
cache_unregister() will be removed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Stanislav Kinsbursky 2011-12-07 12:57:56 +03:00 committed by J. Bruce Fields
parent bd4620ddf6
commit f5c8593b94
3 changed files with 13 additions and 10 deletions

View File

@ -1226,12 +1226,12 @@ nfsd_export_init(void)
int rv; int rv;
dprintk("nfsd: initializing export module.\n"); dprintk("nfsd: initializing export module.\n");
rv = cache_register(&svc_export_cache); rv = cache_register_net(&svc_export_cache, &init_net);
if (rv) if (rv)
return rv; return rv;
rv = cache_register(&svc_expkey_cache); rv = cache_register_net(&svc_expkey_cache, &init_net);
if (rv) if (rv)
cache_unregister(&svc_export_cache); cache_unregister_net(&svc_export_cache, &init_net);
return rv; return rv;
} }
@ -1255,8 +1255,8 @@ nfsd_export_shutdown(void)
dprintk("nfsd: shutting down export module.\n"); dprintk("nfsd: shutting down export module.\n");
cache_unregister(&svc_expkey_cache); cache_unregister_net(&svc_expkey_cache, &init_net);
cache_unregister(&svc_export_cache); cache_unregister_net(&svc_export_cache, &init_net);
svcauth_unix_purge(); svcauth_unix_purge();
dprintk("nfsd: export shutdown complete.\n"); dprintk("nfsd: export shutdown complete.\n");

View File

@ -36,6 +36,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/net_namespace.h>
#include "idmap.h" #include "idmap.h"
#include "nfsd.h" #include "nfsd.h"
@ -466,20 +467,20 @@ nfsd_idmap_init(void)
{ {
int rv; int rv;
rv = cache_register(&idtoname_cache); rv = cache_register_net(&idtoname_cache, &init_net);
if (rv) if (rv)
return rv; return rv;
rv = cache_register(&nametoid_cache); rv = cache_register_net(&nametoid_cache, &init_net);
if (rv) if (rv)
cache_unregister(&idtoname_cache); cache_unregister_net(&idtoname_cache, &init_net);
return rv; return rv;
} }
void void
nfsd_idmap_shutdown(void) nfsd_idmap_shutdown(void)
{ {
cache_unregister(&idtoname_cache); cache_unregister_net(&idtoname_cache, &init_net);
cache_unregister(&nametoid_cache); cache_unregister_net(&nametoid_cache, &init_net);
} }
static int static int

View File

@ -1641,6 +1641,7 @@ int cache_register_net(struct cache_detail *cd, struct net *net)
sunrpc_destroy_cache_detail(cd); sunrpc_destroy_cache_detail(cd);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(cache_register_net);
int cache_register(struct cache_detail *cd) int cache_register(struct cache_detail *cd)
{ {
@ -1653,6 +1654,7 @@ void cache_unregister_net(struct cache_detail *cd, struct net *net)
remove_cache_proc_entries(cd, net); remove_cache_proc_entries(cd, net);
sunrpc_destroy_cache_detail(cd); sunrpc_destroy_cache_detail(cd);
} }
EXPORT_SYMBOL_GPL(cache_unregister_net);
void cache_unregister(struct cache_detail *cd) void cache_unregister(struct cache_detail *cd)
{ {