From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] bind vs. 9660srv
Date: Mon, 10 Aug 2009 10:29:06 -0700 [thread overview]
Message-ID: <dd6fe68a0908101029k6f21e1bco967b143eaba4cad4@mail.gmail.com> (raw)
In-Reply-To: <955d5a290dab26febdf399145b6c5471@quanstro.net>
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
next prev parent reply other threads:[~2009-08-10 17:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 14:41 erik quanstrom
2009-08-10 17:29 ` Russ Cox [this message]
2009-08-10 18:27 ` erik quanstrom
2009-08-10 18:50 ` Russ Cox
2009-08-10 18:57 ` erik quanstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd6fe68a0908101029k6f21e1bco967b143eaba4cad4@mail.gmail.com \
--to=rsc@swtch.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).