shithub: riscv

Download patch

ref: b66c4a6232489ede3bfe29b813d5fee0a66dc11f
parent: 3142af56d8e76ed73d9bc3591f910104a8b2a8b2
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;
--