From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomas Hruby Subject: Re: readdir & bonnie++ Date: Mon, 5 Jun 2006 17:48:04 +0200 Message-ID: <20060605154804.GA19286@fspc268> References: <20060601233334.GA506@fspc268> <20060604094850.GA9923@fspc268> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from top.few.vu.nl ([130.37.20.4]:54498 "EHLO top.few.vu.nl") by vger.kernel.org with ESMTP id S1751192AbWFEPo2 (ORCPT ); Mon, 5 Jun 2006 11:44:28 -0400 To: Akshat Aranya Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > >My problem with bonnie happens in a test which counts how many files where > >created. It just call readdir in loop and counts how many entries were > >returned. As far as I understand the bonnie code, there were no files > >deleted > >yet. > > > >I checked the glibc code (i hope that the correct one) and it seems that > >the > >loop inside readdir is returned only if there are no more data in the > >buffer > >and so the getdents is called again. My problem is that there SHOULD be the > >last entry still in the buffer. > > > > So, what you're saying is that the getdents() call actually returns > the last entry, but readdir() somehow ignores that last entry? If > that is the case, I would look at the d_off value for that last entry > for weirdness. Finally, we found that bug. Thank you all. The problem was that filp->f_pos was set to a wrong value when EOF was detected. And this value is assigned to ->d_off of the last returned entry after returning from vfs_readdir(). This value is checked by getdents() in glibc when checking if the kernel structures are the same as in userspace. The wrong value was 64bit (I forgot to truncate it to 32bits) whereas the userspace value is 32bit only :( Tomas