ndb/cs/dns: make sure never to block the 9p loop when we run out of processes, fail the request instead

This commit is contained in:
cinap_lenrek 2012-07-28 19:17:54 +02:00
parent 15c0d4b7c4
commit b4d2e39d8c
2 changed files with 10 additions and 2 deletions

View file

@ -1654,6 +1654,10 @@ dnsiplookup(char *host, Ndbs *s)
qunlock(&dblock); qunlock(&dblock);
slave(host); slave(host);
if(*isslave == 0){
qlock(&dblock);
return nil;
}
if(strcmp(ipattr(host), "ip") == 0) if(strcmp(ipattr(host), "ip") == 0)
t = dnsquery(mntpt, host, "ptr"); t = dnsquery(mntpt, host, "ptr");

View file

@ -1603,11 +1603,15 @@ netquery(Query *qp, int depth)
return Answnone; return Answnone;
slave(qp->req); slave(qp->req);
/* /*
* slave might have forked. if so, the parent process longjmped to * slave might have forked. if so, the parent process longjmped to
* req->mret; we're usually the child slave, but if there are too * req->mret; we're usually the child slave, but if there are too
* many children already, we're still the same process. * many children already, we're still the same process. under no
* circumstances block the 9p loop.
*/ */
if(!qp->req->isslave && strcmp(qp->req->from, "9p") == 0)
return Answnone;
/* /*
* don't lock before call to slave so only children can block. * don't lock before call to slave so only children can block.
@ -1636,7 +1640,7 @@ netquery(Query *qp, int depth)
" dropping this one; no further logging" " dropping this one; no further logging"
" of drops", dp->name); " of drops", dp->name);
} }
return 0; return Answnone;
} }
++qlp->Ref.ref; ++qlp->Ref.ref;
qunlock(qlp); qunlock(qlp);