ref: 3d20565a78358ed2589359aafeca8a4e7270b57e
parent: 302fc26fdd86f5a4090b4c9bb4292f71bea1d68d
author: cinap_lenrek <[email protected]>
date: Mon Feb 8 14:35:26 EST 2016
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.
--- a/sys/src/cmd/webfs/fs.c
+++ b/sys/src/cmd/webfs/fs.c
@@ -756,6 +756,13 @@
unmount(nil, mtpt);
}
+static void
+fsend(Srv*)
+{
+ postnote(PNGROUP, getpid(), "shutdown");
+ exits(nil);
+}
+
Srv fs =
{
.start=fsstart,
@@ -768,6 +775,7 @@
.write=fswrite,
.flush=fsflush,
.destroyfid=fsdestroyfid,
+ .end=fsend,
};
void
@@ -832,5 +840,5 @@
}
postmountsrv(&fs, service, mtpt, MREPL);
- exits(0);
+ exits(nil);
}
--- a/sys/src/cmd/webfs/http.c
+++ b/sys/src/cmd/webfs/http.c
@@ -240,7 +240,7 @@
/* free the tail */
hcloseall(x);
} while(i);
- exits(0);
+ exits(nil);
}
return;
}
@@ -492,7 +492,7 @@
static void
catch(void *, char *msg)
{
- if(strstr("alarm", msg) || strstr("die", msg))
+ if(strstr("alarm", msg) != nil)
noted(NCONT);
else
noted(NDFLT);
@@ -710,7 +710,7 @@
}else
h->keep = 0;
if(pid == 0)
- exits(0);
+ exits(nil);
}
/* no timeout when posting */
alarm(0);
@@ -1000,5 +1000,5 @@
shdr = k->next;
free(k);
}
- exits(0);
+ exits(nil);
}