Linux filesystem development
 help / color / mirror / Atom feed
From: Livio Baldini Soares <livio@ime.usp.br>
To: Nir Tzachar <tzachar@cs.bgu.ac.il>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: readdir help ;)
Date: Sat, 28 Jun 2003 12:41:43 -0300	[thread overview]
Message-ID: <20030628154143.GA28316@ime.usp.br> (raw)
In-Reply-To: <Pine.LNX.4.44_heb2.09.0306281623350.7181-100000@ruby>

  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

  reply	other threads:[~2003-06-28 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-28 13:42 readdir help ;) Nir Tzachar
2003-06-28 15:41 ` Livio Baldini Soares [this message]
2003-06-29  7:03   ` Nir Tzachar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030628154143.GA28316@ime.usp.br \
    --to=livio@ime.usp.br \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tzachar@cs.bgu.ac.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox