From mboxrd@z Thu Jan 1 00:00:00 1970 From: Livio Baldini Soares Subject: Re: readdir help ;) Date: Sat, 28 Jun 2003 12:41:43 -0300 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20030628154143.GA28316@ime.usp.br> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from birosca.ime.usp.br ([143.107.45.59]:62700 "HELO birosca.ime.usp.br") by vger.kernel.org with SMTP id S265256AbTF1Pbx (ORCPT ); Sat, 28 Jun 2003 11:31:53 -0400 To: Nir Tzachar Content-Disposition: inline In-Reply-To: List-Id: linux-fsdevel.vger.kernel.org Hi Nir, Nir Tzachar writes: > hi all. > > I have a strange problem involving sys_getdents. Let me describe it > shortly: > In my filesystem, i create 200 files with " touch `seq 1 200` " > all the files are created on the f/s (assigned inodes and entered in the > directory structure ) . > But, (and its a very big but..) every time one (or several) of the files > *disappears* . What i mean is, sys_getdents will not return it. > Now, this problem probably arises from smth dumb i did again, but maybe > someone have an insight :) > > Ok, i tried to solve it, and here is what happens: > Firstly, the directory holding the files is ok, and when i > read it with user space tools ( circumventing the vfs ) all is ok. > When i issue a sys_getdents ( via readdir ) i can c all the entries > being read through my file_op->readdir, and i mean all, even the > miscreant one..... Humm... it sounds like you're placing some inconsistent data in the offset (d_off) field (at least when something similar happened to me, that's what I was doing wrong). If you put a bigger value then the correct, readdir may "skip" an entry (on the other hand, even worse things can happen...). Also, be sure to update the f_pos correcly, so that if the buffer fills up, it should point to the the d_off of the last entry _successfully_ proccessed by filldir(). [...] > umounting and mounting again does not solve the problem. > to further complicate the problem, this entry is in the dcache, since > " ls miscreant_entry " works... Well, 'ls' usually does a stat() (or lstat()), and VFS will call your lookup() operation to populate the dcache, if the entry is not there already. As far as I know (at least in 2.4), filldir() does no dcache() population; those two (readdir() and stat()) are unrelated. > well, im buffled. any advice?? Without the code, that's all I can think of now, out of the top of my head... hope this helps. best regards, -- Livio B. Soares