summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/devmnt.c2
-rw-r--r--sys/src/9/port/segment.c4
-rw-r--r--sys/src/9/port/swap.c1
3 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/port/devmnt.c b/sys/src/9/port/devmnt.c
index 63f235ebb..9f6728a4b 100644
--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -706,7 +706,7 @@ mntrdwr(int type, Chan *c, void *buf, long n, vlong off)
if(nreq > c->iounit)
nreq = c->iounit;
- if(type == Tread) {
+ if(type == Tread && (c->flag&CCACHE) != 0) {
nr = cread(c, (uchar*)uba, nreq, off);
if(nr > 0) {
nreq = nr;
diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c
index 987f984cc..d7124caef 100644
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -232,6 +232,9 @@ attachimage(int type, Chan *c, uintptr base, ulong len)
{
Image *i, **l;
+ c->flag &= ~CCACHE;
+ cclunk(c);
+
lock(&imagealloc);
/*
@@ -272,7 +275,6 @@ found:
unlock(&imagealloc);
if(i->c == nil){
i->c = c;
- c->flag &= ~CCACHE;
incref(c);
}
diff --git a/sys/src/9/port/swap.c b/sys/src/9/port/swap.c
index c5e249732..9d492257e 100644
--- a/sys/src/9/port/swap.c
+++ b/sys/src/9/port/swap.c
@@ -424,6 +424,7 @@ setswapchan(Chan *c)
}
}
c->flag &= ~CCACHE;
+ cclunk(c);
swapimage.c = c;
poperror();
}