TRel patch for aufs Each request to aufs ends with a release packet that allowes aufs to continue with the next request. If the release packet is lost the request will not be released before a timeout occurs (which is about 30 seconds). The following patch makes aufs use a second request listner while the first one is waiting for the release packet. Dan email: Dan@dna.lth.se *** aufs.c.prelrel Thu Feb 8 10:42:28 1990 --- aufs.c Thu Feb 8 11:00:42 1990 *************** *** 577,641 **** exit(0); } ! inferior_handler(buf, rspbuf) ! byte *buf; ! byte *rspbuf; { int mask; OSErr err; ! int comp; ! int type,rlen,rsplen; ! ReqRefNumType reqref; umask(0); /* file creates have explict modes */ for (;;) { ! SPGetRequest(cno,buf,mcs,&reqref,&type,&rlen,&comp); ! while (comp > 0) { abSleep(sectotick(60),TRUE); } ! if (comp == SessClosed || comp == ParamErr) { log("Session (%d) closed",cno); clearuserlogin(); /* budd */ return; } ! if (comp < 0) { ! log("SPGetRequest failed %d",comp); continue; } ! if (rlen == 0) continue; #ifndef NOSHUTDOWNCODE /* mask off potential race condition */ mask = sigblock(sigmask(SIGTERM)|sigmask(SIGALRM)); #endif ! switch (type) { case aspWrite: case aspCommand: ! err = SrvrDispatch(buf,rlen,rspbuf,&rsplen,cno,reqref); if (DBSRV) { ! printf("Sending reply len=%d err=%s ...",rsplen,afperr(err)); fflush(stdout); /* force out */ } ! if (type == aspWrite) ! SPWrtReply(cno,reqref,(dword) err,rspbuf,rsplen,&comp); else ! SPCmdReply(cno,reqref,(dword) err,rspbuf,rsplen,&comp); ! while (comp > 0) { abSleep(sectotick(60),TRUE); } ! if (DBSRV) ! printf("done\n"); break; case aspCloseSession: log("Closing ASP Session..."); ! SPCloseSession(cno,10,3,&comp); /* 5 times, .75 seconds */ ! while (comp > 0) abSleep(1, TRUE); sigsetmask(mask); return; default: ! log("Unknown asp command type = %d",type); break; } #ifndef NOSHUTDOWNCODE sigsetmask(mask); #endif } } --- 577,706 ---- exit(0); } ! inferior_handler(buf1, rspbuf1) ! byte *buf1; ! byte *rspbuf1; { int mask; OSErr err; ! int comp1,comp2; ! int type1,rlen1,rsplen1; ! int type2,rlen2,rsplen2; ! ReqRefNumType reqref1; ! ReqRefNumType reqref2; ! byte * buf2; ! byte * rspbuf2; + buf2 = (byte *)malloc(mcs); + rspbuf2 = (byte *)malloc(qs); + if (buf2 == NULL || rspbuf2 == NULL) { + log("memory allocation failure!\n"); + exit(999); + } + + comp1 = 0; + comp2 = 0; umask(0); /* file creates have explict modes */ for (;;) { ! if (comp1 > 0 && comp2 > 0) { ! while (comp1 > 0 && comp2 > 0) { ! abSleep(sectotick(60),TRUE); ! } ! if (DBSRV) ! printf("done\n"); ! } ! ! if (comp1 <= 0) { ! SPGetRequest(cno,buf1,mcs,&reqref1,&type1,&rlen1,&comp1); ! while (comp1 > 0) { abSleep(sectotick(60),TRUE); } ! if (comp1 == SessClosed || comp1 == ParamErr) { log("Session (%d) closed",cno); clearuserlogin(); /* budd */ return; } ! if (comp1 < 0) { ! log("SPGetRequest failed %d",comp1); continue; } ! if (rlen1 == 0) continue; #ifndef NOSHUTDOWNCODE /* mask off potential race condition */ mask = sigblock(sigmask(SIGTERM)|sigmask(SIGALRM)); #endif ! switch (type1) { case aspWrite: case aspCommand: ! err = SrvrDispatch(buf1,rlen1,rspbuf1,&rsplen1,cno,reqref1); if (DBSRV) { ! printf("Sending reply len=%d err=%s ...",rsplen1,afperr(err)); fflush(stdout); /* force out */ } ! if (type1 == aspWrite) ! SPWrtReply(cno,reqref1,(dword) err,rspbuf1,rsplen1,&comp1); else ! SPCmdReply(cno,reqref1,(dword) err,rspbuf1,rsplen1,&comp1); break; case aspCloseSession: log("Closing ASP Session..."); ! SPCloseSession(cno,10,3,&comp1); /* 5 times, .75 seconds */ ! while (comp1 > 0) abSleep(1, TRUE); sigsetmask(mask); return; default: ! log("Unknown asp command type = %d",type1); break; } #ifndef NOSHUTDOWNCODE sigsetmask(mask); #endif + } else { /* comp2 */ + SPGetRequest(cno,buf2,mcs,&reqref2,&type2,&rlen2,&comp2); + while (comp2 > 0) { abSleep(sectotick(60),TRUE); } + if (comp2 == SessClosed || comp2 == ParamErr) { + log("Session (%d) closed",cno); + clearuserlogin(); /* budd */ + return; + } + if (comp2 < 0) { + log("SPGetRequest failed %d",comp2); + continue; + } + if (rlen2 == 0) + continue; + #ifndef NOSHUTDOWNCODE + /* mask off potential race condition */ + mask = sigblock(sigmask(SIGTERM)|sigmask(SIGALRM)); + #endif + switch (type2) { + case aspWrite: + case aspCommand: + err = SrvrDispatch(buf2,rlen2,rspbuf2,&rsplen2,cno,reqref2); + if (DBSRV) { + printf("Sending reply len=%d err=%s ...",rsplen2,afperr(err)); + fflush(stdout); /* force out */ + } + if (type2 == aspWrite) + SPWrtReply(cno,reqref2,(dword) err,rspbuf2,rsplen2,&comp2); + else + SPCmdReply(cno,reqref2,(dword) err,rspbuf2,rsplen2,&comp2); + break; + case aspCloseSession: + log("Closing ASP Session..."); + SPCloseSession(cno,10,3,&comp2); /* 5 times, .75 seconds */ + while (comp2 > 0) + abSleep(1, TRUE); + sigsetmask(mask); + return; + default: + log("Unknown asp command type = %d",type2); + break; + } + #ifndef NOSHUTDOWNCODE + sigsetmask(mask); + #endif + } } }