git: 9front

Download patch

ref: 78f3b950ac5e3d249f23db35cdbe9ae20c05b9de
parent: 09505a4512f22069d7caab39a01fc0edda6589c3
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Oct 24 21:54:09 EDT 2013

kernel: keep one closeproc arround in case we are unable to fork a new one

closechanq() is unable to fork a new closeproc when palloc
is locked. so we spawn a closeproc early in chandevinit()
and make sure theres always one process arround to handle
the queue.

--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -194,6 +194,8 @@
 		devtab[i]->reset();
 }
 
+static void closeproc(void*);
+
 void
 chandevinit(void)
 {
@@ -201,6 +203,7 @@
 
 	for(i=0; devtab[i] != nil; i++)
 		devtab[i]->init();
+	kproc("closeproc", closeproc, nil);
 }
 
 void
@@ -506,6 +509,8 @@
 		c = clunkq.head;
 		if(c == nil){
 			unlock(&clunkq.l);
+			if(canqlock(&clunkq.q))
+				continue;
 			pexit("no work", 1);
 		}
 		clunkq.head = c->next;
--