diff options
-rw-r--r-- | fs/nfs/Makefile | 6 | ||||
-rw-r--r-- | fs/nfs/dns_resolve.c | 32 | ||||
-rw-r--r-- | fs/nfs/inode.c | 11 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 14 |
4 files changed, 44 insertions, 19 deletions
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index cce2c057bd2d..e0bb048e9576 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
@@ -6,8 +6,7 @@ obj-$(CONFIG_NFS_FS) += nfs.o | |||
6 | 6 | ||
7 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o \ | 7 | nfs-y := client.o dir.o file.o getroot.o inode.o super.o \ |
8 | direct.o pagelist.o read.o symlink.o unlink.o \ | 8 | direct.o pagelist.o read.o symlink.o unlink.o \ |
9 | write.o namespace.o mount_clnt.o \ | 9 | write.o namespace.o mount_clnt.o |
10 | dns_resolve.o cache_lib.o | ||
11 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o | 10 | nfs-$(CONFIG_ROOT_NFS) += nfsroot.o |
12 | nfs-$(CONFIG_SYSCTL) += sysctl.o | 11 | nfs-$(CONFIG_SYSCTL) += sysctl.o |
13 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o | 12 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o |
@@ -22,7 +21,8 @@ nfsv3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o | |||
22 | obj-$(CONFIG_NFS_V4) += nfsv4.o | 21 | obj-$(CONFIG_NFS_V4) += nfsv4.o |
23 | nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \ | 22 | nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \ |
24 | delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \ | 23 | delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \ |
25 | nfs4namespace.o nfs4getroot.o nfs4client.o | 24 | nfs4namespace.o nfs4getroot.o nfs4client.o dns_resolve.o |
25 | nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o | ||
26 | nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o | 26 | nfsv4-$(CONFIG_SYSCTL) += nfs4sysctl.o |
27 | nfsv4-$(CONFIG_NFS_V4_1) += nfs4session.o pnfs.o pnfs_dev.o | 27 | nfsv4-$(CONFIG_NFS_V4_1) += nfs4session.o pnfs.o pnfs_dev.o |
28 | 28 | ||
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index 945527092295..fc0f95ec7358 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -29,7 +29,6 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen, | |||
29 | kfree(ip_addr); | 29 | kfree(ip_addr); |
30 | return ret; | 30 | return ret; |
31 | } | 31 | } |
32 | EXPORT_SYMBOL_GPL(nfs_dns_resolve_name); | ||
33 | 32 | ||
34 | #else | 33 | #else |
35 | 34 | ||
@@ -351,7 +350,6 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, | |||
351 | ret = -ESRCH; | 350 | ret = -ESRCH; |
352 | return ret; | 351 | return ret; |
353 | } | 352 | } |
354 | EXPORT_SYMBOL_GPL(nfs_dns_resolve_name); | ||
355 | 353 | ||
356 | static struct cache_detail nfs_dns_resolve_template = { | 354 | static struct cache_detail nfs_dns_resolve_template = { |
357 | .owner = THIS_MODULE, | 355 | .owner = THIS_MODULE, |
@@ -396,6 +394,21 @@ void nfs_dns_resolver_cache_destroy(struct net *net) | |||
396 | cache_destroy_net(nn->nfs_dns_resolve, net); | 394 | cache_destroy_net(nn->nfs_dns_resolve, net); |
397 | } | 395 | } |
398 | 396 | ||
397 | static int nfs4_dns_net_init(struct net *net) | ||
398 | { | ||
399 | return nfs_dns_resolver_cache_init(net); | ||
400 | } | ||
401 | |||
402 | static void nfs4_dns_net_exit(struct net *net) | ||
403 | { | ||
404 | nfs_dns_resolver_cache_destroy(net); | ||
405 | } | ||
406 | |||
407 | static struct pernet_operations nfs4_dns_resolver_ops = { | ||
408 | .init = nfs4_dns_net_init, | ||
409 | .exit = nfs4_dns_net_exit, | ||
410 | }; | ||
411 | |||
399 | static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, | 412 | static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, |
400 | void *ptr) | 413 | void *ptr) |
401 | { | 414 | { |
@@ -432,11 +445,24 @@ static struct notifier_block nfs_dns_resolver_block = { | |||
432 | 445 | ||
433 | int nfs_dns_resolver_init(void) | 446 | int nfs_dns_resolver_init(void) |
434 | { | 447 | { |
435 | return rpc_pipefs_notifier_register(&nfs_dns_resolver_block); | 448 | int err; |
449 | |||
450 | err = register_pernet_subsys(&nfs4_dns_resolver_ops); | ||
451 | if (err < 0) | ||
452 | goto out; | ||
453 | err = rpc_pipefs_notifier_register(&nfs_dns_resolver_block); | ||
454 | if (err < 0) | ||
455 | goto out1; | ||
456 | return 0; | ||
457 | out1: | ||
458 | unregister_pernet_subsys(&nfs4_dns_resolver_ops); | ||
459 | out: | ||
460 | return err; | ||
436 | } | 461 | } |
437 | 462 | ||
438 | void nfs_dns_resolver_destroy(void) | 463 | void nfs_dns_resolver_destroy(void) |
439 | { | 464 | { |
440 | rpc_pipefs_notifier_unregister(&nfs_dns_resolver_block); | 465 | rpc_pipefs_notifier_unregister(&nfs_dns_resolver_block); |
466 | unregister_pernet_subsys(&nfs4_dns_resolver_ops); | ||
441 | } | 467 | } |
442 | #endif | 468 | #endif |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c121982659a2..e09920cacd8b 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include "iostat.h" | 48 | #include "iostat.h" |
49 | #include "internal.h" | 49 | #include "internal.h" |
50 | #include "fscache.h" | 50 | #include "fscache.h" |
51 | #include "dns_resolve.h" | ||
52 | #include "pnfs.h" | 51 | #include "pnfs.h" |
53 | #include "nfs.h" | 52 | #include "nfs.h" |
54 | #include "netns.h" | 53 | #include "netns.h" |
@@ -1646,12 +1645,11 @@ EXPORT_SYMBOL_GPL(nfs_net_id); | |||
1646 | static int nfs_net_init(struct net *net) | 1645 | static int nfs_net_init(struct net *net) |
1647 | { | 1646 | { |
1648 | nfs_clients_init(net); | 1647 | nfs_clients_init(net); |
1649 | return nfs_dns_resolver_cache_init(net); | 1648 | return 0; |
1650 | } | 1649 | } |
1651 | 1650 | ||
1652 | static void nfs_net_exit(struct net *net) | 1651 | static void nfs_net_exit(struct net *net) |
1653 | { | 1652 | { |
1654 | nfs_dns_resolver_cache_destroy(net); | ||
1655 | nfs_cleanup_cb_ident_idr(net); | 1653 | nfs_cleanup_cb_ident_idr(net); |
1656 | } | 1654 | } |
1657 | 1655 | ||
@@ -1669,10 +1667,6 @@ static int __init init_nfs_fs(void) | |||
1669 | { | 1667 | { |
1670 | int err; | 1668 | int err; |
1671 | 1669 | ||
1672 | err = nfs_dns_resolver_init(); | ||
1673 | if (err < 0) | ||
1674 | goto out10;; | ||
1675 | |||
1676 | err = register_pernet_subsys(&nfs_net_ops); | 1670 | err = register_pernet_subsys(&nfs_net_ops); |
1677 | if (err < 0) | 1671 | if (err < 0) |
1678 | goto out9; | 1672 | goto out9; |
@@ -1738,8 +1732,6 @@ out7: | |||
1738 | out8: | 1732 | out8: |
1739 | unregister_pernet_subsys(&nfs_net_ops); | 1733 | unregister_pernet_subsys(&nfs_net_ops); |
1740 | out9: | 1734 | out9: |
1741 | nfs_dns_resolver_destroy(); | ||
1742 | out10: | ||
1743 | return err; | 1735 | return err; |
1744 | } | 1736 | } |
1745 | 1737 | ||
@@ -1752,7 +1744,6 @@ static void __exit exit_nfs_fs(void) | |||
1752 | nfs_destroy_nfspagecache(); | 1744 | nfs_destroy_nfspagecache(); |
1753 | nfs_fscache_unregister(); | 1745 | nfs_fscache_unregister(); |
1754 | unregister_pernet_subsys(&nfs_net_ops); | 1746 | unregister_pernet_subsys(&nfs_net_ops); |
1755 | nfs_dns_resolver_destroy(); | ||
1756 | #ifdef CONFIG_PROC_FS | 1747 | #ifdef CONFIG_PROC_FS |
1757 | rpc_proc_unregister(&init_net, "nfs"); | 1748 | rpc_proc_unregister(&init_net, "nfs"); |
1758 | #endif | 1749 | #endif |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index a5e1a3026d48..5dbe2d269210 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "delegation.h" | 9 | #include "delegation.h" |
10 | #include "internal.h" | 10 | #include "internal.h" |
11 | #include "nfs4_fs.h" | 11 | #include "nfs4_fs.h" |
12 | #include "dns_resolve.h" | ||
12 | #include "pnfs.h" | 13 | #include "pnfs.h" |
13 | #include "nfs.h" | 14 | #include "nfs.h" |
14 | 15 | ||
@@ -331,18 +332,24 @@ static int __init init_nfs_v4(void) | |||
331 | { | 332 | { |
332 | int err; | 333 | int err; |
333 | 334 | ||
334 | err = nfs_idmap_init(); | 335 | err = nfs_dns_resolver_init(); |
335 | if (err) | 336 | if (err) |
336 | goto out; | 337 | goto out; |
337 | 338 | ||
338 | err = nfs4_register_sysctl(); | 339 | err = nfs_idmap_init(); |
339 | if (err) | 340 | if (err) |
340 | goto out1; | 341 | goto out1; |
341 | 342 | ||
343 | err = nfs4_register_sysctl(); | ||
344 | if (err) | ||
345 | goto out2; | ||
346 | |||
342 | register_nfs_version(&nfs_v4); | 347 | register_nfs_version(&nfs_v4); |
343 | return 0; | 348 | return 0; |
344 | out1: | 349 | out2: |
345 | nfs_idmap_quit(); | 350 | nfs_idmap_quit(); |
351 | out1: | ||
352 | nfs_dns_resolver_destroy(); | ||
346 | out: | 353 | out: |
347 | return err; | 354 | return err; |
348 | } | 355 | } |
@@ -352,6 +359,7 @@ static void __exit exit_nfs_v4(void) | |||
352 | unregister_nfs_version(&nfs_v4); | 359 | unregister_nfs_version(&nfs_v4); |
353 | nfs4_unregister_sysctl(); | 360 | nfs4_unregister_sysctl(); |
354 | nfs_idmap_quit(); | 361 | nfs_idmap_quit(); |
362 | nfs_dns_resolver_destroy(); | ||
355 | } | 363 | } |
356 | 364 | ||
357 | MODULE_LICENSE("GPL"); | 365 | MODULE_LICENSE("GPL"); |