Force all conversations to have a write queue
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 3 Aug 2015 19:35:09 +0000 (15:35 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 28 Sep 2015 19:14:00 +0000 (15:14 -0400)
Some parts of #I seem to think that it is possible to not have a write
queue.  However, these checks are spotty.  For instance, there are calls
to qreopen(c->wq).  If there is no wq, that will PF.

It's up to the protocol to establish rq and wq.  All of our protocols
do.  If we need to handle some protocol that doesn't allow sending or
something in the future, then we can deal with it.  Incidentally, an
easy way to do it would be to set up a qbypass that errors out (and
probably frees the block).

kern/src/net/devip.c

index 474e9fa..1071516 100644 (file)
@@ -1167,10 +1167,6 @@ static long ipwrite(struct chan *ch, void *v, long n, int64_t off)
                case Qdata:
                        x = f->p[PROTO(ch->qid)];
                        c = x->conv[CONV(ch->qid)];
-
-                       if (c->wq == NULL)
-                               error(Eperm);
-
                        qwrite(c->wq, a, n);
                        break;
                case Qarp:
@@ -1256,10 +1252,6 @@ static long ipbwrite(struct chan *ch, struct block *bp, uint32_t offset)
                        f = ipfs[ch->dev];
                        x = f->p[PROTO(ch->qid)];
                        c = x->conv[CONV(ch->qid)];
-
-                       if (c->wq == NULL)
-                               error(Eperm);
-
                        if (bp->next)
                                bp = concatblock(bp);
                        n = BLEN(bp);
@@ -1458,6 +1450,7 @@ retry:
                        p->ac++;
                        c->eq = qopen(1024, Qmsg, 0, 0);
                        (*p->create) (c);
+                       assert(c->rq && c->wq);
                        break;
                }
                if (canqlock(&c->qlock)) {