2005-03-02 09:30:42

by Denis Vlasenko

[permalink] [raw]
Subject: Slow/dead NFS mounts when DNS is down

I have a small-to-medium net here and I refer to my internal hosts by IPs,
not names.

Unexpectedly, when external link to Inet is down, NFS mounts are slow.
I didn't expect mountd to use DNS at all if all hosts in /etc/exports
are referred with numeric IP addresses, but it does use DNS.

Narrowing it down, I edited resolv.conf in order to direct DNS queries
to non-existing host, removed 127.0.0.1 localhost from /etc/hosts
and NFS mounts did not work at all.

# cat /etc/exports
# See exports(5) for a description.
# This file contains a list of all directories exported to other computers.
# It is used by rpc.nfsd and rpc.mountd.

/ 127.0.0.1(rw,no_root_squash,async)

This is what happens when I try to mount 127.0.0.1:/ (log of instrumented mountd):

11:04:15 rpc.mountd: MNT3(/) calledd
11:04:15 rpc.mountd: get_rootfh() start
11:04:15 rpc.mountd: get_rootfh() 1
11:04:15 rpc.mountd: get_rootfh() 2
11:04:15 rpc.mountd: auth_authenticate(): get_reliable_hostbyaddr start
11:04:15 rpc.mountd: get_reliable_hostbyaddr(): gethostbyaddr start
here DNS requests time out...
11:04:25 rpc.mountd: get_reliable_hostbyaddr(): gethostbyaddr finish
11:04:25 rpc.mountd: auth_authenticate(): get_reliable_hostbyaddr finish
11:04:25 rpc.mountd: auth_authenticate(): get_hostent start
11:04:25 rpc.mountd: auth_authenticate(): get_hostent finish
11:04:25 rpc.mountd: mount request from unknown host 127.0.0.1 for / (/)

Any suggestions how to properly fix it?

Relevant part of nfsutils-1.0.7 utils/mountd/auth.c
is below sig (instrumentation not shown).

Code flow:
get_reliable_hostbyaddr (DNS timeount) -> get_hostent ->
-> while(1){...} -> switch (error){ ->
-> case unknown_host: -> "mount request from unknown host..."
--
vda

hp = get_reliable_hostbyaddr((const char*)&caller->sin_addr, sizeof(struct in_addr),
AF_INET);
if (!hp)
hp = get_hostent((const char*)&caller->sin_addr, sizeof(struct in_addr),
AF_INET);
if (!hp)
return exp;

/* Try the longest matching exported pathname. */
while (1) {
exp = auth_authenticate_internal(what, caller, epath,
hp, &error);
if (exp || (error != not_exported && error != no_entry))
break;
/* We have to treat the root, "/", specially. */
if (p == &epath[1]) break;
p = strrchr(epath, '/');
if (p == epath) p++;
*p = '\0';
}

switch (error) {
case bad_path:
xlog(L_WARNING, "bad path in %s request from %s: \"%s\"",
what, inet_ntoa(addr), path);
break;

case unknown_host:
xlog(L_WARNING, "%s request from unknown host %s for %s (%s)",



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs