webfs: faster shutdown using postnote()

when the 9p end is closed, post a note to our private note
group to shoot down http procs. this results in quicker
release of namespace resources.
This commit is contained in:
cinap_lenrek 2016-02-08 19:35:26 +01:00
parent 302fc26fdd
commit 3d20565a78
2 changed files with 13 additions and 5 deletions

View file

@ -756,6 +756,13 @@ fsstart(Srv*)
unmount(nil, mtpt); unmount(nil, mtpt);
} }
static void
fsend(Srv*)
{
postnote(PNGROUP, getpid(), "shutdown");
exits(nil);
}
Srv fs = Srv fs =
{ {
.start=fsstart, .start=fsstart,
@ -768,6 +775,7 @@ Srv fs =
.write=fswrite, .write=fswrite,
.flush=fsflush, .flush=fsflush,
.destroyfid=fsdestroyfid, .destroyfid=fsdestroyfid,
.end=fsend,
}; };
void void
@ -832,5 +840,5 @@ main(int argc, char *argv[])
} }
postmountsrv(&fs, service, mtpt, MREPL); postmountsrv(&fs, service, mtpt, MREPL);
exits(0); exits(nil);
} }

View file

@ -240,7 +240,7 @@ hclose(Hconn *h)
/* free the tail */ /* free the tail */
hcloseall(x); hcloseall(x);
} while(i); } while(i);
exits(0); exits(nil);
} }
return; return;
} }
@ -492,7 +492,7 @@ Again:
static void static void
catch(void *, char *msg) catch(void *, char *msg)
{ {
if(strstr("alarm", msg) || strstr("die", msg)) if(strstr("alarm", msg) != nil)
noted(NCONT); noted(NCONT);
else else
noted(NDFLT); noted(NDFLT);
@ -710,7 +710,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
}else }else
h->keep = 0; h->keep = 0;
if(pid == 0) if(pid == 0)
exits(0); exits(nil);
} }
/* no timeout when posting */ /* no timeout when posting */
alarm(0); alarm(0);
@ -1000,5 +1000,5 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
shdr = k->next; shdr = k->next;
free(k); free(k);
} }
exits(0); exits(nil);
} }