9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] another question on u9fs
@ 2003-03-03  2:47 Ronald G. Minnich
  0 siblings, 0 replies; only message in thread
From: Ronald G. Minnich @ 2003-03-03  2:47 UTC (permalink / raw)
  To: 9fans

u9fs serving; v9fs2k client; mounted at /mnt

stat /mnt/tmp/file does this:
<- Twalk tag 0 fid 0 newfid 1 nwname 1 0:tmp 
-> Rwalk tag 0 nwqid 1 0:(0000000000030300 1047737901 d) 
<- Tstat tag 0 fid 1
-> Rstat tag 0  stat 'tmp' '00000000' '00000000' '' q (0000000000030300 
1046689325 d) m 020000000777 at 1046689902 mt 1046689325 l 0 t 0 d 0
.
.
<- Topen tag 0 fid 1 mode 0
-> Ropen tag 0 qid (0000000000030300 1046689325 d) iounit 0 

(open /mnt//tmp/ for a readdir from the linux side)

<- Tread tag 0 fid 1 offset 0 count 512
-> Rread tag 0 count 499 '49000000 00000000 80a77a71 3e670b2d 00000000 
00ff0100 80a77a61 3ea77a61 3e001000 00000000 000a002e 666f6e74 2d756e69 
78080030 30303030 30326208'
<- Tread tag 0 fid 1 offset 499 count 512
-> Rread tag 0 count 507 '40000000 00000000 80decfa8 3dbf4716 00000000 
00fd0100 805a6a2f 3edecfb8 3d001000 00000000 00010078 08003030 30303031 
66340800 30303030 30316634'
.
.
.

read the directory

<- Twalk tag 0 fid 1 newfid 2 nwname 1 0:bad 
-> Rerror tag 0 ename bad use of fid

Try to stat /mnt/tmp/bad by walking from /mnt/tmp (fid 1) to bad with 
newfid 2. 

the bad use of fid is due to the fact that fid 1 is open. 

(gdb) 
432             if(fid->omode != -1){
(gdb) 
433                     seterror(tx, Ebadusefid);

(gdb) print *fid
$1 = {fid = 1, path = 0x80cc498 "/tmp", st = {st_dev = 769, __pad1 = 0, 
    st_ino = 196609, st_mode = 17407, st_nlink = 18, st_uid = 0, st_gid = 
0, 
    st_rdev = 0, __pad2 = 0, st_size = 0, st_blksize = 4096, st_blocks = 
8, 
    st_atime = 1046689902, __unused1 = 0, st_mtime = 1046689325, 
    __unused2 = 0, st_ctime = 1046689335, __unused3 = 0, __unused4 = 0, 
    __unused5 = 0}, u = 0x80cbe38, omode = 0, dir = 0x80cc4a8, 
  diroffset = 2971, fd = -1, dirent = 0x0, next = 0x80cbda0, prev = 0x0}


OK, here's the question. If the newfid is != fid, does it really matter 
that the fid is open? This is pretty much the classical Linux way to ls 
-l: open dir, read dir, stat each thing in dir. So the dir is going to be 
open. Should I be cloning the dir when I open it? Seems inefficient. 

Or should we add code to u9fs rwalk to do this:

        if ((rx->newfid == rx->fid ) && (fid->omode != -1)){
                seterror(tx, Ebadusefid);
                return;
        }

i.e. it's an error to walk an opened fid, but not an error to walk if 
you're going to a new fid? 

What's the right thing to do?

ron




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-03  2:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03  2:47 [9fans] another question on u9fs Ronald G. Minnich

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).