Re: list of mandatory hooks in file system module implementation

"Salvatore Benedetto" <[email protected]> Sun, 24 Aug 2008 16:47:16 +0000
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <[email protected]>
2008/8/24 Ingo Weinhold <[email protected]>:
>
> On 2008-08-24 at 17:46:13 [+0200], Salvatore Benedetto <[email protected]>
> wrote:
>>
>> while working on udf, from time to time I get panics on page fault
>> with an eip = 0x0.
>> This is clearly due to the fact that I forgot to add a certain hook,
>> probably to the fs_vnode_ops
>> structure.
>>
>> I looked around in vfs.cpp for all the FS_CALL call used
>> unconditionally (that is, without calling
>> HAS_FS_CALL first), and I thought I implemented all of them (is
>> remove_vnode necessary btw?),
>> but it seems I'm still missing something. Here is the most important
>> part of a panic I just got
>>
>> udf_lookup: filename = VIDEO_TS found at vnodeId = 262144!
>> vm_soft_fault: va 0x0 not covered by area in address space
>> vm_page_fault: vm_soft_fault returned error 'Bad address' on fault at
>> 0x0, ip 0x0, write 0, user 0, thread 0xc0
>> PANIC: vm_page_fault: unhandled page fault in kernel space at 0x0, ip 0x0
>> ....
>> 12 9217bd58 (+ 124) 00000000
>> 13 9217bdd4 (+  48) 8008ebe7   <kernel>:dir_open_entry_ref__FlxPCcb + 0x008b
>> 14 9217be04 (+ 320) 80093b73   <kernel>:_user_open_dir_entry_ref + 0x006b
>> 15 9217bf44 (+ 100) 800bcee2   <kernel>:pre_syscall_debug_done +
>> 0x0002 (nearest)
>> ...
>>
>> I looked at dir_open_entry_ref in vfs.cpp but honestly I'm not sure
>> which of the function
>> is the one to blame.
>
> Since the innermost function (i.e. the non-existing one at address 0) didn't
> set up a stack frame, the function that called it is missing from the stack
> trace. The return address is on the stack, though. You just have to
> dereference the stack pointer (esp) and lookup the symbol:
>
>  ls *0x8...

I didn't know about that command. Thanks.

>
> Since several of the called functions are static and could be inlined, this
> might not necessarily be the function that actually called the NULL hook. A
> look into the objdump at that address can help you find out what hook was
> called exactly, though.

Ok. Thanks.

>
>> By the way, why is the last entry call (line 12) blank?
>
> That's the NULL pointer that has been called.
>
>> Any help is appreciated.
>>
>> Anyway, as the subject says, I'm wondering if there is a list of
>> mandatory hooks a module
>> should implement.
>
> A while ago I wrote a bit of introduction that also includes a list of hooks
> needed for a minimal read-only FS. It's not up to date (written before the
> last bigger FS interface modifications) and might not be complete. It
> certainly doesn't harm to have a look, though:
>
>  docs/user/drivers/fs_modules.dox

I'll certainly have a look. Thanks.

Anyway, on a second look at dir_open_entry_ref, I saw that cache_node_opened()
calls the node_opened hook, which is implemented in file_cache, while
I use block_cache.
Can that have something to do with it? I'm asking because I honestly
don't know (yet) the difference
between block_cache and file_cache.

Thanks Ingo!

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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/