infinite looping with ls -l on mounted dir

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

infinite looping with ls -l on mounted dir

dmiceman
Hello.

I`m trying to implement fuse module for cramfs image files. That was not
difficult before i step into strange trouble i can`t resolve.

Problem is simple. I`m mount cramfs image somewhere and issue command 'ls -l'
on that dir. One time it works fine, it can works second and third time
(without any visible correlation with anything else). But onse it become to
produce dduplicates (each entry in directory shoun twice or more times) or
completelly blocks and output thousands duplicated entries when i stop my
daemon.

I`m always run fuse with -d flag and can see how it look from that side. There
are no ugly overlays! There just a lot (up to thousands per second)
independed requests processed successfully! It look like (with my debug
messages):

=========================================
unique: 6260, opcode: READLINK (5), nodeid: 2, insize: 40
read_block: offset 1520, bzise 17, size 9, rc 0
readlink: /AppRun -> ./wrapper
   unique: 6260, error: 0 (Success), outsize: 25
unique: 6261, opcode: READDIR (28), nodeid: 1, insize: 64
readdir: entering with /
!!!readdir: locked
readdir: exiting from /, count 7
!!!readdir: unlocked
   unique: 6261, error: 0 (Success), outsize: 320
unique: 6262, opcode: READLINK (5), nodeid: 2, insize: 40
read_block: offset 1520, bzise 17, size 9, rc 0
readlink: /AppRun -> ./wrapper
   unique: 6262, error: 0 (Success), outsize: 25
unique: 6263, opcode: READDIR (28), nodeid: 1, insize: 64
readdir: entering with /
!!!readdir: locked
readdir: exiting from /, count 7
!!!readdir: unlocked
   unique: 6263, error: 0 (Success), outsize: 320
unique: 6264, opcode: READLINK (5), nodeid: 2, insize: 40
read_block: offset 1520, bzise 17, size 9, rc 0
readlink: /AppRun -> ./wrapper
   unique: 6264, error: 0 (Success), outsize: 25
unique: 6265, opcode: READDIR (28), nodeid: 1, insize: 64
readdir: entering with /
!!!readdir: locked
readdir: exiting from /, count 7
!!!readdir: unlocked
   unique: 6265, error: 0 (Success), outsize: 320
=========================================

etc, etc..

I`ll be happy to know it is my fault, but currently i just does not understand
why ls asking for readdir so much times.. To complicate things, i need to say
what this trouble don`t caused when i run 'ls -f'. And i can`t reproduce it
with fusexmp..

I`m using fuse 2.3.0, kernel 2.6.11-gentoo-r8, gcc 3.4.4, glibc 2.3.5 with
nptl.

--
Dmitry Morozhnikov
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

Miklos Szeredi
> I`m trying to implement fuse module for cramfs image files. That was
> not difficult before i step into strange trouble i can`t resolve.
>
> Problem is simple. I`m mount cramfs image somewhere and issue
> command 'ls -l' on that dir. One time it works fine, it can works
> second and third time (without any visible correlation with anything
> else). But onse it become to produce dduplicates (each entry in
> directory shoun twice or more times) or completelly blocks and
> output thousands duplicated entries when i stop my daemon.

Are you passing non-zero offset to filler in readdir?

If so, check whether you are correctly handling directory offsects in
readdir.  It's easy to go wrong.  I recommend, that you first try with
passing zero offsets to filler.

Miklos


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

dmiceman
On Wednesday 21 September 2005 19:50, Miklos Szeredi wrote:
> Are you passing non-zero offset to filler in readdir?
> If so, check whether you are correctly handling directory offsects in
> readdir.  It's easy to go wrong.  I recommend, that you first try with
> passing zero offsets to filler.

No, only zero offsets always..

--
Dmitry Morozhnikov
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

Miklos Szeredi
> > Are you passing non-zero offset to filler in readdir?
> > If so, check whether you are correctly handling directory offsects in
> > readdir.  It's easy to go wrong.  I recommend, that you first try with
> > passing zero offsets to filler.
>
> No, only zero offsets always..

Then maybe it's memory corruption.  Try running with valgrind.

Miklos


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

Miklos Szeredi
> > > Are you passing non-zero offset to filler in readdir?
> > > If so, check whether you are correctly handling directory offsects in
> > > readdir.  It's easy to go wrong.  I recommend, that you first try with
> > > passing zero offsets to filler.
> >
> > No, only zero offsets always..
>
> Then maybe it's memory corruption.  Try running with valgrind.

Or lack of proper locking.  Please check if running with '-s' makes
the problem go away.

Miklos


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

dmiceman
In reply to this post by Miklos Szeredi
On Wednesday 21 September 2005 20:36, Miklos Szeredi wrote:
> Then maybe it's memory corruption.  Try running with valgrind.

I`m runned it will valgrind but i`m not understand it output.. :-(

Messages like "Conditional jump or move depends on uninitialised value" looks
as errors because there are no point for 'off' parameter to be unitialized.
Also i have no idea what "Syscall param writev(vector[...]) points to
uninitialised byte(s)" mean..

I`m attached combined log.

--
Dmitry Morozhnikov
mailto:[hidden email]

fusecram_vallgrind.txt.gz (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

dmiceman
In reply to this post by Miklos Szeredi
On Wednesday 21 September 2005 20:39, Miklos Szeredi wrote:
> Or lack of proper locking.  Please check if running with '-s' makes
> the problem go away.

:-( No difference..

And finally it locks with 'ls -f' too..

--
Dmitry Morozhnikov
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

Miklos Szeredi
In reply to this post by dmiceman
> I`m runned it will valgrind but i`m not understand it output.. :-(
>
> Messages like "Conditional jump or move depends on uninitialised
> value" looks as errors because there are no point for 'off'
> parameter to be unitialized.

Do you mean, you don't pass an 'off' parameter to filler() at all?

That would explain this.  You need to pass zero explicitly (see
examples/fusexmp.c).

> Also i have no idea what "Syscall param writev(vector[...]) points
> to uninitialised byte(s)" mean..

All these are caused by the same uninitialised 'off' value.

Miklos


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

dmiceman
On Wednesday 21 September 2005 22:12, Miklos Szeredi wrote:
> Do you mean, you don't pass an 'off' parameter to filler() at all?

You are god! Thank you very much for great fuse system, great fuse library and
for help with understanding what is going on!

No, i was passed off parameter to filler, but i was used internal definition
for fuse_fill_dir_t because fuse.h was not included into main source file (i
have plans to use this file in other projects). When i replace own definition
with fuse_fill_dir_t just to be sure, i found what fuse.h complains about
_FILE_OFFSET_BITS. This is was root of my problems! When i insert "#define
_FILE_OFFSET_BITS 64" in enough number of places, all problems i was fighting
so long disappeared like nightmare!

Thank you very much again!

--
Dmitry Morozhnikov
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

Miklos Szeredi
> > Do you mean, you don't pass an 'off' parameter to filler() at all?
>
> You are god!

No, I'm very much a mortal, I'm afraid :)

> No, i was passed off parameter to filler, but i was used internal
> definition for fuse_fill_dir_t because fuse.h was not included into
> main source file

Just out of curiosity, what's your reason for not including fuse.h?

Miklos


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: infinite looping with ls -l on mounted dir

dmiceman
On Wednesday 21 September 2005 22:54, Miklos Szeredi wrote:
> > You are god!
> No, I'm very much a mortal, I'm afraid :)

:-) Anyway, thank you very much!

> > No, i was passed off parameter to filler, but i was used internal
> > definition for fuse_fill_dir_t because fuse.h was not included into
> > main source file
> Just out of curiosity, what's your reason for not including fuse.h?

I`m plan to share this source file with other things, not related to FUSE.
Probably i`ll implement KIO module when time allow me..

This thing is target to be used in klik project
(http://www.knoppix.net/forum/viewforum.php?f=17), as an replacement for
kernel-side mounts of cramfs images.

--
Dmitry Morozhnikov
mailto:[hidden email]


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
fuse-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fuse-devel