file struct's dentry being null?
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
Quoted 4 lines · Shaya Potter
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.
Quoted 9 lines
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_headon the superblock). anyways, just trying to figure out what it's pointing to?
Quoted 4 lines
thanks,
shaya
Nikita.
Quoted 1 line
Quoted 9 lines · Nikita Danilov
Quoted 4 lines · Shaya Potter
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_headembedded 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.
Quoted 8 lines · Shaya Potter
Quoted 6 lines · Nikita Danilov
Quoted 4 lines · Shaya Potter
I decided to do an experiment, in fput, I did a
struct file * next;
next = (struct file *)file->f_list.next;
Quoted 8 lines
Quoted 3 lines
->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_headembedded 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 `-------------------------------------------------
Quoted 18 lines · Eli Carter
Quoted 8 lines · Shaya Potter
Quoted 6 lines · Nikita Danilov
Quoted 4 lines · Shaya Potter
I decided to do an experiment, in fput, I did a
struct file * next;
next = (struct file *)file->f_list.next;Quoted 8 lines
Quoted 3 lines
->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_headembedded 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)
Quoted 6 lines
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.
Quoted 18 lines · Eli Carter
Quoted 8 lines · Shaya Potter
Quoted 6 lines · Nikita Danilov
Quoted 4 lines · Shaya Potter
I decided to do an experiment, in fput, I did a
struct file * next;
next = (struct file *)file->f_list.next;Quoted 8 lines
Quoted 3 lines
->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_headembedded 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)
Quoted 6 lines
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);
}}