(Illustration by Gaich Muramatsu)
> On Thu, Mar 31, 2005 at 07:34:29PM +0100, E. Rosten wrote: > > > Returning -ENOENT is definitely the correct thing, the failed lookup > > > will then result in a negative directory cache entry in the kernel > > > (dentry without inode). > > > > I have to reply with ENOENT (not -ENOENT), since the return type is > > unsigned. > > Yeah, sorry. I was looking at the kernel code where we flip the sign of > the returned error code. > > I have tried that, and it still produces exactly the same result. > > > > Well, your comment just made me take another look at that block of code > > (and I have already looked at it 1e99 times) and it turns out I was > > forgetting to set the write size to sizeof(reply.coda_create). I think > > that bit was missing because I had a nut loose on my keyboard. > > Nice catch, Ah, thanks! At least something good came of it. How would this manifest itself? As an error viewable in dmesg, or as an error from the returning write() system call? > it looks like we are getting the reply size, but never > actually check if we got enough data. Since we always read the reply > into a memory page there is no overflow, but we do end up copying the > zero'd bits into whatever structure we return back to the VFS. If you're interested, another problem is that returning an invalid file descriptor from CODA_OPEN_BY_FD, causes all sorts of trouble: it the program issuing then open command hangs for ever, making it impossible to unmount the system. That said, I managed to develop my filesystem without a single kernel panic, which sure beats developing kernel land filesystems. > I guess I can add some sanity checks in the upcall reply path, although > it will be the user application that sees an error and not the cache > manager process that performed the short write. I don't fully understand the whole of CODA yet; is the upcall when the kernel sends a message down /dev/cfs? to the userland process? -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 showpageReceived on 2005-03-31 16:37:32