* readdir help ;)
@ 2003-06-28 13:42 Nir Tzachar
2003-06-28 15:41 ` Livio Baldini Soares
0 siblings, 1 reply; 3+ messages in thread
From: Nir Tzachar @ 2003-06-28 13:42 UTC (permalink / raw)
To: linux-fsdevel
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.....
Filldir return 0 every time, but the entry does not get propagated to
user space, although all the rest entries are ..
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, im buffled. any advice??
========================================================================
nir.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: readdir help ;)
2003-06-28 13:42 readdir help ;) Nir Tzachar
@ 2003-06-28 15:41 ` Livio Baldini Soares
2003-06-29 7:03 ` Nir Tzachar
0 siblings, 1 reply; 3+ messages in thread
From: Livio Baldini Soares @ 2003-06-28 15:41 UTC (permalink / raw)
To: Nir Tzachar; +Cc: linux-fsdevel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: readdir help ;)
2003-06-28 15:41 ` Livio Baldini Soares
@ 2003-06-29 7:03 ` Nir Tzachar
0 siblings, 0 replies; 3+ messages in thread
From: Nir Tzachar @ 2003-06-29 7:03 UTC (permalink / raw)
To: Livio Baldini Soares; +Cc: linux-fsdevel
hello Livio ;)
> things can happen...).Also, be sure to update the f_pos correcly, so
> that if the bufferfills up, it should point to the the d_off of the
> last entry _successfully_ proccessed by filldir().
well, that was my problem. i did not "rewind" the dir position after
filldir returned unsuccessfully.
thanks :):):)
========================================================================
nir.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-29 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-28 13:42 readdir help ;) Nir Tzachar
2003-06-28 15:41 ` Livio Baldini Soares
2003-06-29 7:03 ` Nir Tzachar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox