NFS: DNS resolver cache per network namespace context introduced
This patch implements DNS resolver cache creation and registration for each alive network namespace context. This was done by registering NFS per-net operations, responsible for DNS cache allocation/register and unregister/destructioning instead of initialization and destruction of static "nfs_dns_resolve" cache detail (this one was removed). Pointer to network dns resolver cache is stored in new per-net "nfs_net" structure. This patch also changes nfs_dns_resolve_name() function prototype (and it's calls) by adding network pointer parameter, which is used to get proper DNS resolver cache pointer for do_cache_lookup_wait() call. Note: empty nfs_dns_resolver_init() and nfs_dns_resolver_destroy() functions will be used in next patch in the series. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
committed by
Trond Myklebust
parent
5c1cacb175
commit
1b340d0118
@ -51,6 +51,7 @@
|
||||
#include "fscache.h"
|
||||
#include "dns_resolve.h"
|
||||
#include "pnfs.h"
|
||||
#include "netns.h"
|
||||
|
||||
#define NFSDBG_FACILITY NFSDBG_VFS
|
||||
|
||||
@ -1552,6 +1553,25 @@ static void nfsiod_stop(void)
|
||||
destroy_workqueue(wq);
|
||||
}
|
||||
|
||||
int nfs_net_id;
|
||||
|
||||
static int nfs_net_init(struct net *net)
|
||||
{
|
||||
return nfs_dns_resolver_cache_init(net);
|
||||
}
|
||||
|
||||
static void nfs_net_exit(struct net *net)
|
||||
{
|
||||
nfs_dns_resolver_cache_destroy(net);
|
||||
}
|
||||
|
||||
static struct pernet_operations nfs_net_ops = {
|
||||
.init = nfs_net_init,
|
||||
.exit = nfs_net_exit,
|
||||
.id = &nfs_net_id,
|
||||
.size = sizeof(struct nfs_net),
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize NFS
|
||||
*/
|
||||
@ -1561,9 +1581,13 @@ static int __init init_nfs_fs(void)
|
||||
|
||||
err = nfs_idmap_init();
|
||||
if (err < 0)
|
||||
goto out9;
|
||||
goto out10;
|
||||
|
||||
err = nfs_dns_resolver_init();
|
||||
if (err < 0)
|
||||
goto out9;
|
||||
|
||||
err = register_pernet_subsys(&nfs_net_ops);
|
||||
if (err < 0)
|
||||
goto out8;
|
||||
|
||||
@ -1625,10 +1649,12 @@ out5:
|
||||
out6:
|
||||
nfs_fscache_unregister();
|
||||
out7:
|
||||
nfs_dns_resolver_destroy();
|
||||
unregister_pernet_subsys(&nfs_net_ops);
|
||||
out8:
|
||||
nfs_idmap_quit();
|
||||
nfs_dns_resolver_destroy();
|
||||
out9:
|
||||
nfs_idmap_quit();
|
||||
out10:
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1640,6 +1666,7 @@ static void __exit exit_nfs_fs(void)
|
||||
nfs_destroy_inodecache();
|
||||
nfs_destroy_nfspagecache();
|
||||
nfs_fscache_unregister();
|
||||
unregister_pernet_subsys(&nfs_net_ops);
|
||||
nfs_dns_resolver_destroy();
|
||||
nfs_idmap_quit();
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
Reference in New Issue
Block a user