]> git.lizzy.rs Git - plan9front.git/commitdiff
fix race condition of the CCACHE flag by clearing the flag in
authorcinap_lenrek <cinap_lenrek@rei2>
Thu, 12 Jan 2012 11:54:45 +0000 (12:54 +0100)
committercinap_lenrek <cinap_lenrek@rei2>
Thu, 12 Jan 2012 11:54:45 +0000 (12:54 +0100)
attachimage() instead of temporarily reseting in pio().

sys/src/9/port/fault.c
sys/src/9/port/segment.c

index 4a1cbdbff31fdbc505d5c2cd86a7ba9cb34355e1..5ab0c9f2ed943469e5af0f502e2c7bcbdf74be61 100644 (file)
@@ -200,7 +200,7 @@ pio(Segment *s, ulong addr, ulong soff, Page **p)
        Page *new;
        KMap *k;
        Chan *c;
-       int n, ask, cache;
+       int n, ask;
        char *kaddr;
        ulong daddr;
        Page *loadrec;
@@ -238,18 +238,14 @@ retry:
        k = kmap(new);
        kaddr = (char*)VA(k);
 
-       cache = c->flag & CCACHE;
        while(waserror()) {
-               c->flag |= cache;
                if(strcmp(up->errstr, Eintr) == 0)
                        continue;
                kunmap(k);
                putpage(new);
                faulterror(Eioload, c, 0);
        }
-       c->flag &= ~CCACHE;
        n = devtab[c->type]->read(c, kaddr, ask, daddr);
-       c->flag |= cache;
        if(n != ask)
                faulterror(Eioload, c, 0);
        if(ask < BY2PG)
index db896c9e331be9555acd14b1d9486edad0d77ee6..aa0ab33cc8b731b899eb47b6104f90a116ad2d28 100644 (file)
@@ -287,6 +287,7 @@ attachimage(int type, Chan *c, ulong base, ulong len)
 
        lock(i);
        incref(c);
+       c->flag &= ~CCACHE;
        i->c = c;
        i->type = c->type;
        i->qid = c->qid;