Subject: bin/758: unmount tries to gethostbyname() on union mount fake names
To: None <gnats-admin@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 01/28/1995 11:20:03
>Number:         758
>Category:       bin
>Synopsis:       unmount tries to gethostbyname() on union mount fake names
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 28 11:20:01 1995
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        -current, as of Jan 21
>Environment:
	
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #0: Sat Jan 28 13:28:18 EST 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386


>Description:
When umount tries to unmount a union mounted file system, it will try to
gethostbyname() on the "<below>" or "<above>" tag.  This can hang a long
time if you have a nameserver configured but no network connectivity at
the moment (e.g. what I have at home when PPP is not connected).

>How-To-Repeat:
Do a union mount, and try to unmount.  Watch the nameserver lookups fly
by, (or wait a long time for the timeouts if you're disconnected)

>Fix:
Only do the lookup for type NFS mounts.

--- 1.1	1995/01/28 18:41:38
+++ src/sbin/umount/umount.c	1995/01/28 18:46:28
@@ -216,6 +216,8 @@
 	if (!selected(type))
 		return (1);
 
+	hp = NULL;
+	if (strcmp(type, "nfs") == 0) {
 	if ((delimp = strchr(name, '@')) != NULL) {
 		hostp = delimp + 1;
 		*delimp = '\0';
@@ -227,8 +229,8 @@
 		hp = gethostbyname(hostp);
 		name = delimp + 1;
 		*delimp = ':';
-	} else
-		hp = NULL;
+	    }
+	}
 	if (!namematch(hp))
 		return (1);
 

>Audit-Trail:
>Unformatted: