ref: a1fa3d75d834b5c89872eb800664db28ae7780c5
parent: c9d2fecbd06d0e9efc2fa16f214f1612a9a40d93
author: cinap_lenrek <[email protected]>
date: Tue Feb 16 14:06:54 EST 2016
ndb/dns: removing the buggy /net.alt remount hack
--- a/sys/src/cmd/ndb/dnresolve.c
+++ b/sys/src/cmd/ndb/dnresolve.c
@@ -20,7 +20,6 @@
Maxdest= 24, /* maximum destinations for a request message */
Maxoutstanding= 15, /* max. outstanding queries per domain name */
- Remntretry= 15, /* min. sec.s between /net.alt remount tries */
/*
* these are the old values; we're trying longer timeouts now
@@ -1427,31 +1426,6 @@
return Answnone;
}
-/*
- * run a command with a supplied fd as standard input
- */
-char *
-system(int fd, char *cmd)
-{
- int pid, p, i;
- static Waitmsg msg;
-
- if((pid = fork()) == -1)
- sysfatal("fork failed: %r");
- else if(pid == 0){
- dup(fd, 0);
- close(fd);
- for (i = 3; i < 200; i++)
- close(i); /* don't leak fds */
- execl("/bin/rc", "rc", "-c", cmd, nil);
- sysfatal("exec rc: %r");
- }
- for(p = waitpid(); p >= 0; p = waitpid())
- if(p == pid)
- return msg.msg;
- return "lost child";
-}
-
/* compute wait, weighted by probability of success, with bounds */
static ulong
weight(ulong ms, unsigned pcntprob)
@@ -1475,13 +1449,9 @@
udpquery(Query *qp, char *mntpt, int depth, int patient, int inns)
{
int fd, rv;
- long now;
ulong pcntprob;
uvlong wait, reqtm;
- char *msg;
uchar *obuf, *ibuf;
- static QLock mntlck;
- static ulong lastmount;
rv = -1;
@@ -1490,29 +1460,6 @@
obuf = emalloc(Maxudp+Udphdrsize);
fd = udpport(mntpt);
- while (fd < 0 && cfg.straddle && strcmp(mntpt, "/net.alt") == 0) {
- /* HACK: remount /net.alt */
- now = time(nil);
- if (now < lastmount + Remntretry)
- sleep(S2MS(lastmount + Remntretry - now));
- qlock(&mntlck);
- fd = udpport(mntpt); /* try again under lock */
- if (fd < 0) {
- dnslog("[%d] remounting /net.alt", getpid());
- unmount(nil, "/net.alt");
-
- msg = system(open("/dev/null", ORDWR), "outside");
-
- lastmount = time(nil);
- if (msg && *msg) {
- dnslog("[%d] can't remount /net.alt: %s",
- getpid(), msg);
- sleep(10*1000); /* don't spin remounting */
- } else
- fd = udpport(mntpt);
- }
- qunlock(&mntlck);
- }
if (fd < 0) {
dnslog("can't get udpport for %s query of name %s: %r",
mntpt, qp->dp->name);