From 5826140ce394025d21ab8d2b2c21c12720e88a59 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 8 Mar 2020 05:52:23 +0100 Subject: [PATCH] lib9p: restore previous behaviour of fd group sharing it appears that too many fileservers rely on the fileserver process sharing the filedescriptors with children of the caller to postmntsrv() or threadpostmntsrv(). restoring previous behaviour for now. --- sys/src/lib9p/post.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/src/lib9p/post.c b/sys/src/lib9p/post.c index 0241c3157..65a98e1f6 100644 --- a/sys/src/lib9p/post.c +++ b/sys/src/lib9p/post.c @@ -23,7 +23,10 @@ _postmountsrv(Srv *s, char *name, char *mtpt, int flag) if(_forker == nil) sysfatal("no forker"); - _forker(postproc, s, RFNAMEG|RFFDG|RFNOTEG); + _forker(postproc, s, RFNAMEG|RFNOTEG); + + rfork(RFFDG); + rendezvous(0, 0); close(s->infd); if(s->infd != s->outfd) @@ -52,7 +55,10 @@ _postsharesrv(Srv *s, char *name, char *mtpt, char *desc) if(_forker == nil) sysfatal("no forker"); - _forker(postproc, s, RFNAMEG|RFFDG|RFNOTEG); + _forker(postproc, s, RFNAMEG|RFNOTEG); + + rfork(RFFDG); + rendezvous(0, 0); close(s->infd); if(s->infd != s->outfd) @@ -72,6 +78,7 @@ postproc(void *v) Srv *s; s = v; + rendezvous(0, 0); close(s->srvfd); srv(s); }