[Gluster-devel] How to fix wrong telldir/seekdir usage

Emmanuel Dreyfus manu at netbsd.org
Sun Sep 14 07:39:02 UTC 2014

Pranith Kumar Karampuri <pkarampu at redhat.com> wrote:

> I believe posix xlator doesn't have this problem for 
> non-anonymous fds where the DIR* stream is open till the final unref on
> the fd.

You must be right since reading a directory in a glusterfs volume does
not cause an infinite loop on NetBSD [1]. A quick inspection in the code
seems to suggest that we only have opendir/readdir/closedir in the same
function, and the opendir in posix_opendir.

snapview-server seems to suffer the same problem as index, though.

[1] reusing for seekdir() an offset obtained by telldir() on another DIR
* is unspecified. On Linux it seems to work (without any guarantee it is
reliable) NetBSD it is nilpotent, which cause readdir() to always
restart at the beginning of the directory.

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list