[haiku-gsoc] Re: [HCD]: Bfs bug #1

  • From: "Salvatore Benedetto" <emitrax@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Wed, 18 Jun 2008 14:01:11 +0000

2008/6/18 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> The more interesting question would be why get_vnode() failed in the
> first place, though.

I investigated this a bit and in the serial log I found before the crash
that the vnode is not becoming "unbusy"

vnode 3:4260 is not becoming unbusy!
vnode 0x9149ff00
PANIC: ASSERT FAILED (src/system/kernel/fs/vfs.cpp:801): oldRefCount > 0

At first, this seems the reason, but I don't know why this is
happening and I'll look into
it more.

However, in Index::SetTo()

    Vnode vnode(fVolume, id);
    if (vnode.Get(&fNode) != B_OK)
        return B_ENTRY_NOT_FOUND;

if Get fails, for the reason above, the error B_BUSY is propagated
back but more or less
ignored, because Index::SetTo would return B_ENTRY_NOT_FOUND which is
not quite correct
and despite of that, the destructor of VNode would be called, causing
the crash as not check is made
on the success of get_vnode.

I'd suggest to fix the VNode class with a boolean flag that has to be
set by the Get
method, so in case of error by get_vnode like in this case, put_vnode would not
be called. Any comments? Can I go ahead with this fix just mentioned?

However, the reasoning of the vnode staying busy still needs an explanation! :-)

One question, in the following Vnode method

        status_t Get(Inode **_inode)
        {
            // should we check inode against NULL here? it should not
be necessary
            return get_vnode(fVolume->FSVolume(), fID, (void **)_inode);
        }

what's the comment referring to? The _inode passed or the returned value?

Regards,
-- 
Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa
www.haiku-os.it

Other related posts: