From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <955d5a290dab26febdf399145b6c5471@quanstro.net> References: <955d5a290dab26febdf399145b6c5471@quanstro.net> Date: Mon, 10 Aug 2009 10:29:06 -0700 Message-ID: Subject: Re: [9fans] bind vs. 9660srv From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 40dc39da-ead5-11e9-9d60-3106f5b1d025 This is a kernel bug. sysfile.c:/^read says dir = c->qid.type&QTDIR; if(dir && mountrockread(c, p, n, &nn)){ /* do nothing: mountrockread filled buffer */ }else{ if(dir && c->umh) nn = unionread(c, p, n); else nn = devtab[c->type]->read(c, p, n, off); } if(dir) nnn = mountfix(c, p, nn, n); else nnn = nn; but should say (untested) if(c->qid.type&QTDIR) { if(mountrockread(c, p, n, &nn)) { /* do nothing: mountrockread filled buffer */ } else if(c->umh) { nn = unionread(c, p, n); } else { if(off != c->offset) error(Edirseek); nn = devtab[c->type]->read(c, p, n, c->devoffset); } nnn = mountfix(c, p, nn, n); } else { nn = devtab[c->type]->read(c, p, n, off); nnn = nn; } I have separated out the various if(dir) tests into one block, but more importantly the new code passes c->devoffset to the directory read. No one noticed before because most 9P2000 servers assume they are being used correctly and implement a simpler check: if offset == 0, seek to beginning, otherwise continue where the last read left off. Russ