[Gluster-devel] readdir() harmful in threaded code

Kaleb S. KEITHLEY kkeithle at redhat.com
Mon Jul 25 11:26:00 UTC 2016


On 07/23/2016 10:32 AM, Emmanuel Dreyfus wrote:
> Pranith Kumar Karampuri <pkarampu at redhat.com> wrote:
> 
>> So should we do readdir() with external locks for everything instead?
> 
> readdir() with a per-directory lock is safe. However, it may come with a
> performance hit in some scenarios, since two threads cannot read the
> same directory at once. But I am not sure it can happen in GlusterFS.
> 
> I am a bit disturbed by readdir_r() being planned for deprecation. The
> Open Group does not say that, or I missed it:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

You should take that concern up, perhaps, with the glibc people.

As for GlusterFS, the recent change I made only affects Linux/glibc.

Non-linux platforms are unchanged; they use the same old hodgepodge of
readdir(3)/readdir_r(3) they always have.

As such I don't understand what it is that you're concerned about.

-- 

Kaleb


More information about the Gluster-devel mailing list