All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sm-notify: perform DNS lookup in the background.
@ 2008-07-15  6:21 Neil Brown
       [not found] ` <18556.16890.235207.711721-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Neil Brown @ 2008-07-15  6:21 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs



Hi Steve,
 if you agree with the following patch, it can be pulled from

  git://neil.brown.name/nfs-utils for-steved


Thanks,
NeilBrown


From: Neil Brown <neilb@suse.de>
Date: Tue, 15 Jul 2008 06:11:55 +1000
Subject: [PATCH] sm-notify: perform DNS lookup in the background.

If an NFS server has no network connectivity when it reboots,
it will block in sm-notify waiting for DNS lookup for a potentially
large number of hosts.  This is not helpful and just annoys the
sysadmin.

So do the DNS lookup in the backgrounded phase of sm-notify,
before sending off the NOTIFY requests.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 utils/statd/sm-notify.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index bb67c37..8e00aac 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -286,6 +286,20 @@ notify(void)
 			hp = hosts;
 			hosts = hp->next;
 
+			if (hp->ai == NULL)
+				hp->ai = host_lookup(AF_UNSPEC, hp->name);
+			if (hp->ai == NULL) {
+				nsm_log(LOG_WARNING,
+					"%s doesn't seem to be a valid address,"
+					" skipped",
+					hp->name);
+				unlink(hp->path);
+				free(hp->name);
+				free(hp->path);
+				free(hp);
+				continue;
+			}
+
 			notify_host(sock, hp);
 
 			/* Set the timeout for this call, using an
@@ -532,15 +546,6 @@ get_hosts(const char *dirname)
 		if (stat(path, &stb) < 0)
 			continue;
 
-		host->ai = host_lookup(AF_UNSPEC, de->d_name);
-		if (! host->ai) {
-			nsm_log(LOG_WARNING,
-				"%s doesn't seem to be a valid address, skipped",
-				de->d_name);
-			unlink(path);
-			continue;
-		}
-
 		host->last_used = stb.st_mtime;
 		host->timeout = NSM_TIMEOUT;
 		host->path = strdup(path);
-- 
1.5.6.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-18  4:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-15  6:21 [PATCH] sm-notify: perform DNS lookup in the background Neil Brown
     [not found] ` <18556.16890.235207.711721-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-15 15:31   ` Chuck Lever
     [not found]     ` <76bd70e30807150831l294c7f0as8ba53709e71d5827-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-16 18:43       ` Steve Dickson
2008-07-17  2:41         ` Neil Brown
     [not found]           ` <18558.45412.19541.657376-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-17 10:29             ` Steve Dickson
2008-07-17 22:46               ` Neil Brown
2008-07-17 15:09             ` Chuck Lever
2008-07-17 22:59               ` Neil Brown
     [not found]                 ` <18559.52918.675492.673560-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-18  4:41                   ` Chuck Lever

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.