ref: 9d60d8262e4ab285da2903192a341ceb81a05eb5
parent: 3599f733ee9828b80a6f470646463793e01838e3
author: cinap_lenrek <[email protected]>
date: Sun Feb 5 19:23:38 EST 2012
fix potential double ready in postnote() for rendezvous
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -95,7 +95,7 @@
procalloc.free = up;
/* proc is free now, make sure unlock() wont touch it */
- up = procalloc.p = nil;
+ up = procalloc.Lock.p = nil;
unlock(&procalloc);
sched();
}
@@ -418,7 +418,7 @@
print("double ready %s %lud pc %p\n", p->text, p->pid, getcallerpc(&p));
return;
}
-
+
s = splhi();
if(edfready(p)){
splx(s);
@@ -984,16 +984,16 @@
if(p->state == Rendezvous) {
Proc *d, **l;
- p->rendval = ~0;
l = &REND(p->rgrp, p->rendtag);
for(d = *l; d; d = d->rendhash) {
if(d == p) {
*l = p->rendhash;
+ p->rendval = ~0;
+ ready(p);
break;
}
l = &d->rendhash;
}
- ready(p);
}
unlock(p->rgrp);
break;
--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -811,7 +811,6 @@
tag = arg[0];
l = &REND(up->rgrp, tag);
- up->rendval = ~(uintptr)0;
lock(up->rgrp);
for(p = *l; p; p = p->rendhash) {
@@ -819,11 +818,10 @@
*l = p->rendhash;
val = p->rendval;
p->rendval = arg[1];
-
+ unlock(up->rgrp);
while(p->mach != 0)
;
ready(p);
- unlock(up->rgrp);
return val;
}
l = &p->rendhash;