public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 30/32] NFS: Add a dns resolver for use with NFSv4 referrals and migration
Date: Wed, 19 Aug 2009 19:51:56 -0400	[thread overview]
Message-ID: <1250725916.12555.1.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1250725135-14632-31-git-send-email-Trond.Myklebust@netapp.com>

On Wed, 2009-08-19 at 19:38 -0400, Trond Myklebust wrote:
> The NFSv4 and NFSv4.1 protocols both allow for the redirection of a client
> from one server to another in order to support filesystem migration and
> replication. For full protocol support, we need to add the ability to
> convert a DNS host name into an IP address that we can feed to the RPC
> client.
> 
> We'll reuse the sunrpc cache, now that it has been converted to work with
> rpc_pipefs.

Should I merge this too?

From: Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: NFS: Testcase for the DNS resolver

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 fs/nfs/Kconfig           |   11 ++++++++++
 fs/nfs/Makefile          |    4 +++
 fs/nfs/cache_testcases.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/dns_resolve.c     |    1 +
 4 files changed, 69 insertions(+), 0 deletions(-)
 create mode 100644 fs/nfs/cache_testcases.c


diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 2a77bc2..13fc471 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -101,3 +101,14 @@ config NFS_FSCACHE
 	help
 	  Say Y here if you want NFS data to be cached locally on disc through
 	  the general filesystem cache manager
+
+config NFS_CACHETEST
+	tristate "Test the NFS client DNS cache upcalls"
+	depends on NFS_FS
+	default N
+	help
+	  Choose M if you want to build a module that can be used to test
+	  the NFS client DNS cache upcall mechanism.
+
+	  Most people will want to say N
+
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index da7fda6..4fe5ac2 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -17,3 +17,7 @@ nfs-$(CONFIG_NFS_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
 			   nfs4namespace.o
 nfs-$(CONFIG_SYSCTL) += sysctl.o
 nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
+
+obj-$(CONFIG_NFS_CACHETEST) += nfs_cachetest.o
+nfs_cachetest-objs := cache_testcases.o
+
diff --git a/fs/nfs/cache_testcases.c b/fs/nfs/cache_testcases.c
new file mode 100644
index 0000000..2d8810a
--- /dev/null
+++ b/fs/nfs/cache_testcases.c
@@ -0,0 +1,53 @@
+/*
+ * linux/fs/nfs/cache_testcases.c
+ *
+ * Testcases for the NFS client cache upcalls
+ *
+ * Copyright (c) 2009 Trond Myklebust <Trond.Myklebust@netapp.com>
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/sunrpc/clnt.h>
+
+#include "dns_resolve.h"
+
+static char hostname[NFS_DNS_HOSTNAME_MAXLEN] = "";
+module_param_string(hostname, hostname, sizeof(hostname), 0600);
+MODULE_PARM_DESC(hostname, "DNS hostname to look up");
+
+static int nfs_lookup_hostname(char *name)
+{
+	struct sockaddr_storage sa;
+	ssize_t salen;
+
+	if (!name || *name == '\0')
+		goto out;
+	salen = nfs_dns_resolve_name(name, strlen(name),
+			(struct sockaddr *)&sa, sizeof(sa));
+	if (salen > 0) {
+		char buf[INET6_ADDRSTRLEN+IPV6_SCOPE_ID_LEN+1];
+
+		rpc_ntop((struct sockaddr *)&sa, buf, sizeof(buf));
+		printk(KERN_NOTICE "%15s ", buf);
+	} else
+		printk(KERN_NOTICE "%15zd ", salen);
+	printk("%15s\n", name);
+out:
+	return 0;
+}
+
+static int nfs_dnstest_init(void)
+{
+	return nfs_lookup_hostname(hostname);
+}
+
+static void nfs_dnstest_exit(void)
+{
+}
+
+MODULE_AUTHOR("Trond Myklebust <Trond.Myklebust@netapp.com>");
+MODULE_LICENSE("GPL");
+
+module_init(nfs_dnstest_init)
+module_exit(nfs_dnstest_exit)
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index f4d54ba..572d453 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -322,6 +322,7 @@ ssize_t nfs_dns_resolve_name(char *name, size_t namelen,
 		ret = -ESRCH;
 	return ret;
 }
+EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
 
 int nfs_dns_resolver_init(void)
 {

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

  parent reply	other threads:[~2009-08-19 23:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19 23:38 [PATCH 00/32] The following patches have been committed to branch nfs-for-2.6.32 Trond Myklebust
2009-08-19 23:38 ` [PATCH 01/32] nfs: Keep index within mnt_errtbl[] Trond Myklebust
2009-08-19 23:38   ` [PATCH 02/32] NFSv4: Don't loop forever on state recovery failure Trond Myklebust
2009-08-19 23:38     ` [PATCH 03/32] NFSv4: Add 'server capability' flags for NFSv4 recommended attributes Trond Myklebust
2009-08-19 23:38       ` [PATCH 04/32] NFSv4: Don't do idmapper upcalls for asynchronous RPC calls Trond Myklebust
2009-08-19 23:38         ` [PATCH 05/32] SUNRPC: convert some sysctls into module parameters Trond Myklebust
2009-08-19 23:38           ` [PATCH 06/32] NFSv4: Clean up the nfs.callback_tcpport option Trond Myklebust
2009-08-19 23:38             ` [PATCH 07/32] SUNRPC: Constify rpc_pipe_ops Trond Myklebust
2009-08-19 23:38               ` [PATCH 08/32] SUNRPC: Allow rpc_pipefs_ops to have null values for upcall and downcall Trond Myklebust
2009-08-19 23:38                 ` [PATCH 09/32] SUNRPC: Clean up rpc_pipefs lookup code Trond Myklebust
2009-08-19 23:38                   ` [PATCH 10/32] SUNRPC: Clean up file creation code in rpc_pipefs Trond Myklebust
2009-08-19 23:38                     ` [PATCH 11/32] SUNRPC: Clean up rpc_unlink() Trond Myklebust
2009-08-19 23:38                       ` [PATCH 12/32] SUNRPC: Clean up rpc_lookup_create Trond Myklebust
2009-08-19 23:38                         ` [PATCH 13/32] SUNRPC: Clean up rpc_populate/depopulate Trond Myklebust
2009-08-19 23:38                           ` [PATCH 14/32] SUNRPC: rpc_pipefs cleanup Trond Myklebust
2009-08-19 23:38                             ` [PATCH 15/32] SUNRPC: Rename rpc_mkdir to rpc_create_client_dir() Trond Myklebust
2009-08-19 23:38                               ` [PATCH 16/32] SUNRPC: Clean up rpc_create_client_dir() Trond Myklebust
2009-08-19 23:38                                 ` [PATCH 17/32] SUNRPC: Replace rpc_client->cl_dentry and cl_mnt, with a cl_path Trond Myklebust
2009-08-19 23:38                                   ` [PATCH 18/32] SUNRPC: clean up rpc_setup_pipedir() Trond Myklebust
2009-08-19 23:38                                     ` [PATCH 19/32] SUNRPC: One more clean up for rpc_create_client_dir() Trond Myklebust
2009-08-19 23:38                                       ` [PATCH 20/32] NFSD: Clean up the idmapper warning Trond Myklebust
2009-08-19 23:38                                         ` [PATCH 21/32] SUNRPC: Ensure we initialise the cache_detail before creating procfs files Trond Myklebust
2009-08-19 23:38                                           ` [PATCH 22/32] SUNRPC: Remove the global temporary write buffer in net/sunrpc/cache.c Trond Myklebust
2009-08-19 23:38                                             ` [PATCH 23/32] SUNRPC: Allow the cache_detail to specify alternative upcall mechanisms Trond Myklebust
2009-08-19 23:38                                               ` [PATCH 24/32] SUNRPC: Move procfs-specific stuff out of the generic sunrpc cache code Trond Myklebust
2009-08-19 23:38                                                 ` [PATCH 25/32] SUNRPC: Add an rpc_pipefs front end for the " Trond Myklebust
2009-08-19 23:38                                                   ` [PATCH 26/32] NFS: Add a ->migratepage() aop for NFS Trond Myklebust
2009-08-19 23:38                                                     ` [PATCH 27/32] NFS: read-modify-write page updating Trond Myklebust
2009-08-19 23:38                                                       ` [PATCH 28/32] nfs: remove superfluous BUG_ON()s Trond Myklebust
2009-08-19 23:38                                                         ` [PATCH 29/32] SUNRPC: Fix a typo in cache_pipefs_files Trond Myklebust
     [not found]                                                           ` <1250725135-14632-31-git-send-email-Trond.Myklebus! t@! ne! tapp.com>
     [not found]                                                           ` <1250725135-14632-31-git-send-email-Trond.Myklebust@! ne! tapp.com>
2009-08-19 23:38                                                           ` [PATCH 30/32] NFS: Add a dns resolver for use with NFSv4 referrals and migration Trond Myklebust
2009-08-19 23:38                                                             ` [PATCH 31/32] NFS: Use the DNS resolver in the mount code Trond Myklebust
2009-08-19 23:38                                                               ` [PATCH 32/32] SUNRPC: cache must take a reference to the cache detail's module on open() Trond Myklebust
2009-08-19 23:51                                                             ` Trond Myklebust [this message]
     [not found]                                                               ` <1250725916.12555.1.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-08-21 20:47                                                                 ` [PATCH 30/32] NFS: Add a dns resolver for use with NFSv4 referrals and migration J. Bruce Fields
2009-08-21 20:57                                                                   ` Chuck Lever
2009-08-20 15:34                                                             ` Chuck Lever
2009-08-20 16:25                                                               ` Trond Myklebust
     [not found]                                                                 ` <1250785542.19156.12.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-08-20 16:54                                                                   ` Chuck Lever
2009-08-20 19:11                                                                     ` Trond Myklebust
     [not found]                                                                       ` <1250795483.26904.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-08-20 21:13                                                                         ` Chuck Lever
2009-08-20 21:03                                                             ` J. Bruce Fields
2009-08-20 21:08                                                               ` [PATCH] nfs: fix compile error in rpc_pipefs.h J. Bruce Fields
2009-08-20 22:23                                                               ` [PATCH 30/32] NFS: Add a dns resolver for use with NFSv4 referrals and migration Trond Myklebust
     [not found]                                                                 ` <1250807011.6514.8.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-08-20 22:33                                                                   ` J. Bruce Fields
2009-08-20 22:39                                                                     ` Trond Myklebust
2009-08-21 13:42                                                             ` Jeff Layton
     [not found]                                                               ` <20090821094248.23bc54f1-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2009-08-21 14:21                                                                 ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250725916.12555.1.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox