9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Skip Tavakkolian <9nut@9netics.com>
To: 9fans@cse.psu.edu
Subject: Re: device-specific qid.version behaviour (was Re: [9fans] QTCTL?)
Date: Mon,  5 Nov 2007 11:52:05 -0800	[thread overview]
Message-ID: <872562cb6911793f3b35fc3c03bb98b6@9netics.com> (raw)
In-Reply-To: <a4e6962a0711051025k2d5cd608q43a2125770a4a794@mail.gmail.com>

>> maybe 9p2010 Tread/Twrite could include the qid, which may be
>> supplied by the client (or left out).  if qid is supplied then the fs
>> has the option to enforce it; otherwise it works as it does now.
>>
> 
> Confused as to what you are saying here - could you clarify?

when client opens a file and gets a qid back, it assumes that the
fid it uses corresponds to the qid it was given. if in subsequent reads
the file changes but reads for that fid still succeed (even though
file contents have changed and the old qid doesn't match the "current"
file), this could be a problem. this is the case with ctl files. read the
same file at the same offset, get different answers each time but
the qid.vers stays the same.

for a client that cares (e.g.  something that caches the data), it
could ask on every read which version of the file it really wants.  if
it doesn't care which version, it would leave it up to the fs to
decide whether it will strictly enforce version change.  might
answer questions like what should the output of cat after sleep
really be?

cpu% ramfs
cpu% cd /tmp
cpu% ls
cpu% touch foo
cpu% cat foo
cpu% {sleep 20 && cat}<foo&
cpu% echo 123 > foo
cpu% 123


now in slow motion. which qid should fid 976 correspond to?

cpu% ramfs -D
ramfs 137391:<-Tversion tag 65535 msize 8216 version '9P2000'
ramfs 137391:->Rversion tag 65535 msize 8216 version '9P2000'
ramfs 137391:<-Tattach tag 9 fid 1122 afid -1 uname fst aname 
ramfs 137391:->Rattach tag 9 qid (0000000000000000 0 d)
cpu% cd /tmp
cpu% touch foo
ramfs 137391:<-Twalk tag 9 fid 1122 newfid 1238 nwname 1 0:touch 
ramfs 137391:->Rerror tag 9 ename file does not exist
ramfs 137391:<-Twalk tag 9 fid 1122 newfid 976 nwname 1 0:foo 
ramfs 137391:->Rerror tag 9 ename file does not exist
ramfs 137391:<-Twalk tag 9 fid 1122 newfid 1033 nwname 1 0:foo 
ramfs 137391:->Rerror tag 9 ename file does not exist
ramfs 137391:<-Twalk tag 9 fid 1122 newfid 1033 nwname 0 
ramfs 137391:->Rwalk tag 9 nwqid 0 
ramfs 137391:<-Tcreate tag 9 fid 1033 name foo perm %M% mode 438
ramfs 137391:->Rcreate tag 9 qid (0000000000000001 0 ) iounit 8192 
ramfs 137391:<-Twstat tag 9 fid 1033 stat '' '' '' '' q (ffffffffffffffff 4294967295 dalA) m 037777777777 at -1 mt 1194291310 l -1 t 65535 d -1
ramfs 137391:->Rwstat tag 9
ramfs 137391:<-Tclunk tag 9 fid 1033
ramfs 137391:->Rclunk tag 9
cpu% {sleep 30 && cat}<foo&
cpu% ramfs 137391:<-Twalk tag 9 fid 1122 newfid 976 nwname 1 0:foo 
ramfs 137391:->Rwalk tag 9 nwqid 1 0:(0000000000000001 0 ) 
ramfs 137391:<-Topen tag 9 fid 976 mode 0
ramfs 137391:->Ropen tag 9 qid (0000000000000001 0 ) iounit 8192 
ramfs 137391:<-Twalk tag 9 fid 1122 newfid 1188 nwname 1 0:sleep 
ramfs 137391:->Rerror tag 9 ename file does not exist

cpu% echo 123 > foo
ramfs 137391:<-Twalk tag 46 fid 1122 newfid 1247 nwname 1 0:foo 
ramfs 137391:->Rwalk tag 46 nwqid 1 0:(0000000000000001 0 ) 
ramfs 137391:<-Topen tag 46 fid 1247 mode 17
ramfs 137391:->Ropen tag 46 qid (0000000000000001 1 ) iounit 8192 
ramfs 137391:<-Twalk tag 46 fid 1122 newfid 1033 nwname 1 0:echo 
ramfs 137391:->Rerror tag 46 ename file does not exist
ramfs 137391:<-Twrite tag 46 fid 1247 offset 0 count 4 '123
'
ramfs 137391:->Rwrite tag 46 count 4
ramfs 137391:<-Tclunk tag 46 fid 1247
ramfs 137391:->Rclunk tag 46
cpu% ls -q foo
ramfs 137391:<-Twalk tag 46 fid 1122 newfid 1188 nwname 1 0:ls 
ramfs 137391:->Rerror tag 46 ename file does not exist
ramfs 137391:<-Twalk tag 46 fid 1122 newfid 1247 nwname 1 0:foo 
ramfs 137391:->Rwalk tag 46 nwqid 1 0:(0000000000000001 2 ) 
ramfs 137391:<-Tstat tag 46 fid 1247
ramfs 137391:->Rstat tag 46  stat 'foo' 'fst' 'fst' 'fst' q (0000000000000001 2 ) m 0664 at 1194291310 mt 1194291342 l 4 t 65535 d -256
ramfs 137391:<-Tclunk tag 46 fid 1247
ramfs 137391:->Rclunk tag 46
(0000000000000001 2 00) foo
cpu% ramfs 137391:<-Twalk tag 9 fid 1122 newfid 1247 nwname 1 0:cat 
ramfs 137391:->Rerror tag 9 ename file does not exist
ramfs 137391:<-Tread tag 9 fid 976 offset 0 count 8192
ramfs 137391:->Rread tag 9 count 4 '123
'
123
ramfs 137391:<-Tread tag 9 fid 976 offset 4 count 8192
ramfs 137391:->Rread tag 9 count 0 ''
ramfs 137391:<-Tclunk tag 9 fid 976
ramfs 137391:->Rclunk tag 9

cpu% 


  reply	other threads:[~2007-11-05 19:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 11:18 roger peppe
2007-11-05 13:18 ` erik quanstrom
2007-11-05 14:35   ` roger peppe
2007-11-05 15:01     ` erik quanstrom
2007-11-05 16:10       ` roger peppe
2007-11-05 16:40         ` erik quanstrom
2007-11-05 17:06           ` roger peppe
2007-11-05 17:54             ` erik quanstrom
2007-11-05 22:17               ` roger peppe
2007-11-05 23:21                 ` erik quanstrom
2007-11-06  0:53                   ` Charles Forsyth
2007-11-05 17:26           ` Skip Tavakkolian
2007-11-05 18:25             ` Eric Van Hensbergen
2007-11-05 19:52               ` Skip Tavakkolian [this message]
2007-11-05 22:12                 ` Skip Tavakkolian
2007-11-05 16:42         ` erik quanstrom
2007-11-05 15:27     ` 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=872562cb6911793f3b35fc3c03bb98b6@9netics.com \
    --to=9nut@9netics.com \
    --cc=9fans@cse.psu.edu \
    /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).