shithub: riscv

Download patch

ref: a2d96d47c996d3e31d5a93771c2cf91f994a5473
parent: b7d8431036d1fbc8d366ef9ddff5e6ab93e4bc94
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Apr 29 17:17:07 EDT 2014

kernel: always reset notepending in eqlock, handle forceclosefgrp in eqlocks

--- a/sys/src/9/port/pgrp.c
+++ b/sys/src/9/port/pgrp.c
@@ -225,7 +225,7 @@
 }
 
 /*
- * Called from sleep because up is in the middle
+ * Called from interrupted() because up is in the middle
  * of closefgrp and just got a kill ctl message.
  * This usually means that up has wedged because
  * of some kind of deadly embrace with mntclose
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -130,6 +130,7 @@
 void		iallocsummary(void);
 long		ibrk(uintptr, int);
 void		ilock(Lock*);
+void		interrupted(void);
 void		iunlock(Lock*);
 long		incref(Ref*);
 void		initseg(void);
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -802,12 +802,18 @@
 	if(up->notepending) {
 		up->notepending = 0;
 		splx(s);
-		if(up->procctl == Proc_exitme && up->closingfgrp)
-			forceclosefgrp();
-		error(Eintr);
+		interrupted();
 	}
 
 	splx(s);
+}
+
+void
+interrupted(void)
+{
+	if(up->procctl == Proc_exitme && up->closingfgrp != nil)
+		forceclosefgrp();
+	error(Eintr);
 }
 
 static int
--- a/sys/src/9/port/qlock.c
+++ b/sys/src/9/port/qlock.c
@@ -39,8 +39,9 @@
 	if(up == 0)
 		panic("eqlock");
 	if(up->notepending){
+		up->notepending = 0;
 		unlock(&q->use);
-		error(Eintr);
+		interrupted();
 	}
 	rwstats.qlockq++;
 	p = q->tail;
@@ -57,7 +58,7 @@
 	sched();
 	if(up->eql == 0){
 		up->notepending = 0;
-		error(Eintr);
+		interrupted();
 	}
 	up->eql = 0;
 }