Coda File System

Problem with CODA_LOOKUP,

From: E. Rosten <er258_at_eng.cam.ac.uk>
Date: Thu, 31 Mar 2005 17:14:48 +0100 (BST)
Hi all,

I'm currently writing a userland filesystem under Linux, which used the 
coda module to to the kernel side of the filing, since this is the best 
option avaliable in the stock kernel. Anyway, the problem is this:

when a file is being accessed for the first time, coda issues a 
CODA_LOOKUP (the reply of which contains a FID), and then follows with a 
CODA_GETATTR (and then does whatever it wants, such as opening the file).

This is all fine when an existing file is being accessed. My problems 
arrive when I try to create a new file. I've tested this with various 
things, but mainly with a program which calls creat() and nothing else.

CODA_LOOKUP is issued, to which I reply with ENOENT (I assume that this is 
the correct thing to do here). Coda then follows up with a CODA_CREATE. 
I reply with a new FID and a sensible set of attributes (I know they're 
sensible, since I use them in the reply to CODA_GETATTR). However, 
whatever attributes I reply with, is never sets the new file up in a 
sensible way. ls -l gives:

?---------  4095 root  33188   0 1970-01-01 01:00 aaa

where aaa is the new file. As you can see, it has the file permissions and 
type, the number of hardlinks, and the UID and GID incorrect. I have not 
found a way of getting this to work correctly. *

Can anyone here tell me what I'm doing wrong?

If anyone wants to look at the code, it's here:

http://mi.eng.cam.ac.uk/~er258/code/dist/gnokiifs/gnokiifs.cpp

It's relatively big, but it is centred around one large switch statement 
in main, which gets a request, deals with is and replies, with no nasty 
out of sequence threading stuff happening. In the CODA_LOOKUP and 
CODA_CREATE bits of the switch statement, there is only a small amount of 
code anyway. Currently the reply to CREATE, replys with the attributes 
that the CREATE request gives, but I've tried changing them to no avail.


I'm using the standard coda module that comes with Linux 2.6.9


*The workaround I have is to currently reply with success to all 
CODA_LOOKUPs. This works, but it means that 

ls a_nonexistent_file

Will happily list a file that doesn't exist. Further, things like test -f 
always think files exist.


Thanks

-Ed




-- 
(You can't go wrong with psycho-rats.)       (er258)(@)(eng.cam)(.ac.uk)

/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage
Received on 2005-03-31 11:16:38