aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2011-11-25 09:13:04 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-01-31 18:20:26 -0500
commit1b340d0118da1d7c60c664f17d7c8fce2bb1cd9d (patch)
treea66a9626f8fca21bd42d13a3b4270b168e2186fc /fs/nfs/inode.c
parent5c1cacb175185ed925d7dc13ac7e0653e7a633cd (diff)
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>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index f649fba8c384..0335f6e4ff7e 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -51,6 +51,7 @@
51#include "fscache.h" 51#include "fscache.h"
52#include "dns_resolve.h" 52#include "dns_resolve.h"
53#include "pnfs.h" 53#include "pnfs.h"
54#include "netns.h"
54 55
55#define NFSDBG_FACILITY NFSDBG_VFS 56#define NFSDBG_FACILITY NFSDBG_VFS
56 57
@@ -1552,6 +1553,25 @@ static void nfsiod_stop(void)
1552 destroy_workqueue(wq); 1553 destroy_workqueue(wq);
1553} 1554}
1554 1555
1556int nfs_net_id;
1557
1558static int nfs_net_init(struct net *net)
1559{
1560 return nfs_dns_resolver_cache_init(net);
1561}
1562
1563static void nfs_net_exit(struct net *net)
1564{
1565 nfs_dns_resolver_cache_destroy(net);
1566}
1567
1568static struct pernet_operations nfs_net_ops = {
1569 .init = nfs_net_init,
1570 .exit = nfs_net_exit,
1571 .id = &nfs_net_id,
1572 .size = sizeof(struct nfs_net),
1573};
1574
1555/* 1575/*
1556 * Initialize NFS 1576 * Initialize NFS
1557 */ 1577 */
@@ -1561,10 +1581,14 @@ static int __init init_nfs_fs(void)
1561 1581
1562 err = nfs_idmap_init(); 1582 err = nfs_idmap_init();
1563 if (err < 0) 1583 if (err < 0)
1564 goto out9; 1584 goto out10;
1565 1585
1566 err = nfs_dns_resolver_init(); 1586 err = nfs_dns_resolver_init();
1567 if (err < 0) 1587 if (err < 0)
1588 goto out9;
1589
1590 err = register_pernet_subsys(&nfs_net_ops);
1591 if (err < 0)
1568 goto out8; 1592 goto out8;
1569 1593
1570 err = nfs_fscache_register(); 1594 err = nfs_fscache_register();
@@ -1625,10 +1649,12 @@ out5:
1625out6: 1649out6:
1626 nfs_fscache_unregister(); 1650 nfs_fscache_unregister();
1627out7: 1651out7:
1628 nfs_dns_resolver_destroy(); 1652 unregister_pernet_subsys(&nfs_net_ops);
1629out8: 1653out8:
1630 nfs_idmap_quit(); 1654 nfs_dns_resolver_destroy();
1631out9: 1655out9:
1656 nfs_idmap_quit();
1657out10:
1632 return err; 1658 return err;
1633} 1659}
1634 1660
@@ -1640,6 +1666,7 @@ static void __exit exit_nfs_fs(void)
1640 nfs_destroy_inodecache(); 1666 nfs_destroy_inodecache();
1641 nfs_destroy_nfspagecache(); 1667 nfs_destroy_nfspagecache();
1642 nfs_fscache_unregister(); 1668 nfs_fscache_unregister();
1669 unregister_pernet_subsys(&nfs_net_ops);
1643 nfs_dns_resolver_destroy(); 1670 nfs_dns_resolver_destroy();
1644 nfs_idmap_quit(); 1671 nfs_idmap_quit();
1645#ifdef CONFIG_PROC_FS 1672#ifdef CONFIG_PROC_FS