* file struct's dentry being null?
@ 2003-07-02 15:49 Shaya Potter
2003-07-02 15:58 ` Nikita Danilov
0 siblings, 1 reply; 6+ messages in thread
From: Shaya Potter @ 2003-07-02 15:49 UTC (permalink / raw)
To: linux-fsdevel
I decided to do an experiment, in fput, I did a
struct file * next;
next = (struct file *) file->f_list.next;
if ( !next->dentry )
printk("file struct: next's dentry is null, %d\n", next);
and I get a bunch of kernel output along these lines, with 5 different
next memory locations. I only have 3 mount points, so it doesn't seem
to be related to that (though I would have thought it might have been
the list_head on the superblock). anyways, just trying to figure out
what it's pointing to?
thanks,
shaya
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file struct's dentry being null?
2003-07-02 15:49 file struct's dentry being null? Shaya Potter
@ 2003-07-02 15:58 ` Nikita Danilov
2003-07-02 16:00 ` Shaya Potter
0 siblings, 1 reply; 6+ messages in thread
From: Nikita Danilov @ 2003-07-02 15:58 UTC (permalink / raw)
To: Shaya Potter; +Cc: linux-fsdevel
Shaya Potter writes:
> I decided to do an experiment, in fput, I did a
>
> struct file * next;
> next = (struct file *) file->f_list.next;
->f_list.next points to the ->f_list member of next struct file rather
than to the struct file itself. This is how it works for all struct
list_head embedded into objects.
> if ( !next->dentry )
> printk("file struct: next's dentry is null, %d\n", next);
>
> and I get a bunch of kernel output along these lines, with 5 different
> next memory locations. I only have 3 mount points, so it doesn't seem
> to be related to that (though I would have thought it might have been
> the list_head on the superblock). anyways, just trying to figure out
> what it's pointing to?
>
> thanks,
>
> shaya
>
Nikita.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file struct's dentry being null?
2003-07-02 15:58 ` Nikita Danilov
@ 2003-07-02 16:00 ` Shaya Potter
2003-07-02 16:18 ` Eli Carter
0 siblings, 1 reply; 6+ messages in thread
From: Shaya Potter @ 2003-07-02 16:00 UTC (permalink / raw)
To: Nikita Danilov; +Cc: linux-fsdevel
On Wed, 2003-07-02 at 11:58, Nikita Danilov wrote:
> Shaya Potter writes:
> > I decided to do an experiment, in fput, I did a
> >
> > struct file * next;
> > next = (struct file *) file->f_list.next;
>
> ->f_list.next points to the ->f_list member of next struct file rather
> than to the struct file itself. This is how it works for all struct
> list_head embedded into objects.
yes, I understand that, the idea being that it's the first entry in the
struct that you want to link list, so can get the next struct by just
dereferencing the list_head (as &list_head == &struct)
I was just cheating, but that explains my point, I could see it being
null if I hit the real list_head (i.e. on the superblock), but I am
getting 5 distinct "hits", with only 3 mount points, so trying to figure
out why.
the issue I'm trying to figure out is (posted once b4) that I am getting
corrupt entries off of ext3's file list in it's superblock, so that when
fs_may_remount_ro() is called, it oops with a null pointer exception.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file struct's dentry being null?
2003-07-02 16:00 ` Shaya Potter
@ 2003-07-02 16:18 ` Eli Carter
2003-07-02 16:26 ` Shaya Potter
2003-07-02 16:32 ` Shaya Potter
0 siblings, 2 replies; 6+ messages in thread
From: Eli Carter @ 2003-07-02 16:18 UTC (permalink / raw)
To: Shaya Potter; +Cc: Nikita Danilov, linux-fsdevel
Shaya Potter wrote:
> On Wed, 2003-07-02 at 11:58, Nikita Danilov wrote:
>
>>Shaya Potter writes:
>> > I decided to do an experiment, in fput, I did a
>> >
>> > struct file * next;
>> > next = (struct file *) file->f_list.next;
>>
>>->f_list.next points to the ->f_list member of next struct file rather
>>than to the struct file itself. This is how it works for all struct
>>list_head embedded into objects.
>
>
> yes, I understand that, the idea being that it's the first entry in the
> struct that you want to link list, so can get the next struct by just
> dereferencing the list_head (as &list_head == &struct)
No, his point was that &list_head != $struct, but rather &struct ==
&list_head - some_offset.
So the code you'd need would look like:
struct file *next;
next = list_entry( <address of the list_head>, file, f_list );
Eli
--------------------. "If it ain't broke now,
Eli Carter \ it will be soon." -- crypto-gram
eli.carter(a)inet.com `-------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file struct's dentry being null?
2003-07-02 16:18 ` Eli Carter
@ 2003-07-02 16:26 ` Shaya Potter
2003-07-02 16:32 ` Shaya Potter
1 sibling, 0 replies; 6+ messages in thread
From: Shaya Potter @ 2003-07-02 16:26 UTC (permalink / raw)
To: Eli Carter; +Cc: Nikita Danilov, linux-fsdevel
On Wed, 2003-07-02 at 12:18, Eli Carter wrote:
> Shaya Potter wrote:
> > On Wed, 2003-07-02 at 11:58, Nikita Danilov wrote:
> >
> >>Shaya Potter writes:
> >> > I decided to do an experiment, in fput, I did a
> >> >
> >> > struct file * next;
> >> > next = (struct file *) file->f_list.next;
> >>
> >>->f_list.next points to the ->f_list member of next struct file rather
> >>than to the struct file itself. This is how it works for all struct
> >>list_head embedded into objects.
> >
> >
> > yes, I understand that, the idea being that it's the first entry in the
> > struct that you want to link list, so can get the next struct by just
> > dereferencing the list_head (as &list_head == &struct)
>
> No, his point was that &list_head != $struct, but rather &struct ==
> &list_head - some_offset.
>
> So the code you'd need would look like:
> struct file *next;
> next = list_entry( <address of the list_head>, file, f_list );
ok, right, looked at list_entry again, and I tried to cheat too much.
that's for the pointer.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: file struct's dentry being null?
2003-07-02 16:18 ` Eli Carter
2003-07-02 16:26 ` Shaya Potter
@ 2003-07-02 16:32 ` Shaya Potter
1 sibling, 0 replies; 6+ messages in thread
From: Shaya Potter @ 2003-07-02 16:32 UTC (permalink / raw)
To: Eli Carter; +Cc: Nikita Danilov, linux-fsdevel
On Wed, 2003-07-02 at 12:18, Eli Carter wrote:
> Shaya Potter wrote:
> > On Wed, 2003-07-02 at 11:58, Nikita Danilov wrote:
> >
> >>Shaya Potter writes:
> >> > I decided to do an experiment, in fput, I did a
> >> >
> >> > struct file * next;
> >> > next = (struct file *) file->f_list.next;
> >>
> >>->f_list.next points to the ->f_list member of next struct file rather
> >>than to the struct file itself. This is how it works for all struct
> >>list_head embedded into objects.
> >
> >
> > yes, I understand that, the idea being that it's the first entry in the
> > struct that you want to link list, so can get the next struct by just
> > dereferencing the list_head (as &list_head == &struct)
>
> No, his point was that &list_head != $struct, but rather &struct ==
> &list_head - some_offset.
>
> So the code you'd need would look like:
> struct file *next;
> next = list_entry( <address of the list_head>, file, f_list );
ok, even with that fix, I'm still getting the same sort of output
I'm printing out 6 different distinct memory locations whose next entry
in the file list has a null dentry.
The system operates normally like this, so just trying to figure out
what its dereferencing.
this is the block of code I stick in fput()
{
struct file * next;
next = list_entry(file->f_list.next, struct file, f_list);
if ( !next->f_dentry )
{
printk("deleting dentry whose next is null!, next = %d\n",next);
}
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-07-02 16:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-02 15:49 file struct's dentry being null? Shaya Potter
2003-07-02 15:58 ` Nikita Danilov
2003-07-02 16:00 ` Shaya Potter
2003-07-02 16:18 ` Eli Carter
2003-07-02 16:26 ` Shaya Potter
2003-07-02 16:32 ` Shaya Potter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.