>> 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 via email to