From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shaya Potter Subject: Re: file struct's dentry being null? Date: 02 Jul 2003 12:32:29 -0400 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1057163549.7361.19.camel@zaphod> References: <1057160991.7361.5.camel@zaphod> <16131.276.323954.605302@laputa.namesys.com> <1057161617.7361.10.camel@zaphod> <3F0305CD.40100@inet.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Nikita Danilov , linux-fsdevel@vger.kernel.org Return-path: Received: from opus.cs.columbia.edu ([128.59.20.100]:9640 "EHLO opus.cs.columbia.edu") by vger.kernel.org with ESMTP id S265090AbTGBQVD (ORCPT ); Wed, 2 Jul 2003 12:21:03 -0400 To: Eli Carter In-Reply-To: <3F0305CD.40100@inet.com> List-Id: linux-fsdevel.vger.kernel.org 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(
, 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); } }