kern: awake & dev9p: do not interrupt Tflush to avoid consuming all tags

This commit is contained in:
Giacomo Tesio 2017-12-08 01:53:32 +01:00
parent 3946a06a98
commit b73c2bce14
3 changed files with 37 additions and 0 deletions

View File

@ -239,6 +239,19 @@ awake_fell_asleep(Proc *p)
}
}
Syscalls
awake_disable(void)
{
Syscalls blockingsc = up->wakeups[up->notified].blockingsc;
up->wakeups[up->notified].blockingsc = 0;
return blockingsc;
}
void
awake_enable(Syscalls s)
{
up->wakeups[up->notified].blockingsc = s;
}
int
awake_should_wake_up(Proc *p)
{

View File

@ -805,6 +805,7 @@ mountio(Mnt *mnt, Mntrpc *r)
{
Block *b;
int n;
Syscalls awksysc;
while(waserror()) {
if(mnt->rip == up)
@ -854,7 +855,28 @@ mountio(Mnt *mnt, Mntrpc *r)
if(mnt->rip == nil)
break;
unlock(&mnt->l);
if(r->request.type == Tflush){
/* Tflush must not be interrupted by awake
* or we will consume all tags trying: since
* awake cannot know that it's not worth to
* flush an interrupted flush it will interrupt
* them all and each interrupt will cause
* a new flush to be sent.
*
* TODO: verify we do not have to do the same
* with notes
*/
awksysc = awake_disable();
if(waserror()){
awake_enable(awksysc);
nexterror();
}
}
sleep(r->z, rpcattn, r);
if(r->request.type == Tflush){
awake_enable(awksysc);
poperror();
}
if(r->done){
poperror();
mntflushfree(mnt, r);

View File

@ -33,6 +33,8 @@ Block* allocb(int);
Block* allocbalign(int, int);
int anyhigher(void);
int anyready(void);
Syscalls awake_disable(void);
void awake_enable(Syscalls s);
void awake_tick(unsigned long tick);
void awake_timer(void*);
void awake_ringer(void*);