Re: help with ext3 reserved inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 6, 2009 at 11:50 PM, Donato Capitella<d.capitella@xxxxxx> wrote:
> Ok, this is what I want to do.
>
> I'm developing a patch to ext3; this patch uses a queue of structures
> representing tasks to be performed and a separated kernel thread that
> reads the structures from the queue as they become available and
> performs the required task on the filesystem.
>
> So, if the system crashes when there are still things to do in the
> queue, those tasks won't be accomplished. That's why I want to keep this
> queue in a reserved inode so that I can restart the tasks in case of
> system crash.
>
> Now, what am I trying to develop? Basically this function:
>
> write_to_log(my_struct *task) {
>        1. get reserved inode
>        2. append the struct pointed to by task to the reserved inode
> }

Hmm.. Can you try to write something like ext3_get_journal() and tell
us the errors you are enountering. And also could you post what is the
output of "stat <3>" after you have initialized your reserved inode.
Instead of trying to reference any pointer and do any operation, could
you just try to print success or the errno from the ext3_iget()

Thanks -
Manish


>
> I tried to be clear, my English doesn't help I guess :P.
>
> Thanks again for your time,
> Donato :D
>
>
> On Mon, 2009-07-06 at 22:47 +0530, Manish Katiyar wrote:
>> On Mon, Jul 6, 2009 at 8:45 PM, Donato Capitella<d.capitella@xxxxxx> wrote:
>>
>> [ Please keep kernelnewbies in cc while replying ]
>>
>> > Well, I tried to initialize the inode 3 with debugfs, but nothing
>> > changed. I just set the file mode and the creation but when I try to
>> > read the inode with the ext3_iget() function, somehow it fails and
>> > dereferences a NULL pointer :(
>>
>> What pointer is NULL ? ext3_iget doesn't return a NULL pointer (either
>> it returns a valid inode pointer or an errno typecasted as ptr). Where
>> is it crashing ? What are you using the reserved inode for ?
>>
>>
>> >
>> > Maybe I am missing something.
>>
>> Unless you tell us the complete picture it might be hard to identify.
>> A snippet of code would definitely help, but I am pretty sure that it
>> is because you don't have a valid inode structure on disk and you need
>> to initialize it appropriately.
>>
>> > Which fields do I need to initialize in
>> > order for this to work?
>>
>> Have you tried the same thing on ext2 first ? I would suggest doing
>> that because ext2_iget() is much simpler than ext3_iget(). While
>> setting i_mode you also need to take care that mode also consists of
>> filetype apart from permissions. You also may have to initialize
>> i_nlinks appropriately
>>
>> >Shouldn't be this hard to just read an inode...
>> It isn't but you need to create a valid inode before that.
>>
>> Thanks -
>> Manish
>>
>> >
>> > Thanks again,
>> > Donato
>> >
>> >
>> > On Sun, 2009-07-05 at 22:37 +0530, Manish Katiyar wrote:
>> >> On Sun, Jul 5, 2009 at 10:28 PM, Donato Capitella<d.capitella@xxxxxx> wrote:
>> >> > Well, as it's a reserved inode, I didn't create it. stat <3> shows that
>> >> > the inode has bad type... so this might be the problem. But how am I
>> >> > supposed to initialize the inode fields if I can't read it?
>> >>
>> >> What are you reserving it for ? Note that the reserved inodes today (2
>> >> for root) & (8 for journal commonly) both are initialized during mkfs.
>> >> You also need to do something similar. Depending on what you are using
>> >> it for you may need to initialize it properly. To do that you can do
>> >> the following :-
>> >>
>> >> a) Either write a simple C program to write the fields properly at
>> >> correct offset.
>> >> b) Hack the code of mkfs to include your inode too.
>> >> c) Use debugfs to change the contents of inode 3. This is the easiest
>> >> option but I am not sure if you can modify all the fields of the
>> >> inode, so it depends on what you need.
>> >>
>> >> Thanks -
>> >> Manish
>> >>
>> >> >
>> >> >
>> >> > On Sun, 2009-07-05 at 22:06 +0530, Manish Katiyar wrote:
>> >> >> On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitella<d.capitella@xxxxxx> wrote:
>> >> >> > Hi there,
>> >> >> > I need some help with a patch to the ext3 filesystem I'm developing. I'm
>> >> >> > completelly new to kernel programming and I need to understand
>> >> >> > practically how to use one of the ext3 reserved inode for storing a log.
>> >> >> >
>> >> >> > I thought it would be just as easy as getting the inode with the
>> >> >> > ext3_iget() function, but it doesn't seem to be the case. For example,
>> >> >> > if I try to load the third reserved inode like this :
>> >> >> >
>> >> >> > inode = ext3_iget(sb, 3);
>> >> >> >
>> >> >> > ext3_iget() fails somehow and crashes the process with a NULL pointer
>> >> >> > reference. What am I missing here?
>> >> >> Have you created the inode 3 ? What entries does it have ? What does
>> >> >> "stat <3>" show from the debugfs ?
>> >> >>
>> >> >> Thanks -
>> >> >> Manish
>> >> >>
>> >> >>
>> >> >> > How do you use a reserved inode? Can
>> >> >> > anybody point to some documentation or project that uses reserved
>> >> >> > inodes?
>> >> >> >
>> >> >> > I'm really stuck :(
>> >> >> >
>> >> >> > Thanks a lot,
>> >> >> > Donato Capitella
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > To unsubscribe from this list: send an email with
>> >> >> > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>> >> >> > Please read the FAQ at http://kernelnewbies.org/FAQ
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>
>
>



-- 
Thanks -
Manish

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux