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

2016-07-25 Thread Niels de Vos
On Mon, Jul 25, 2016 at 05:43:30AM +0200, Emmanuel Dreyfus wrote: > Vijay Bellur wrote: > > > Do you have any concrete examples of problems encountered due to the > > same directory stream being invoked from multiple threads? > > I am not sure this scenario can happen, but

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

2016-07-25 Thread Kaleb S. KEITHLEY
On 07/25/2016 07:26 AM, Kaleb S. KEITHLEY wrote: > On 07/23/2016 10:32 AM, Emmanuel Dreyfus wrote: >> Pranith Kumar Karampuri wrote: >> >>> So should we do readdir() with external locks for everything instead? >> >> readdir() with a per-directory lock is safe. However, it may

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

2016-07-25 Thread Kaleb S. KEITHLEY
On 07/23/2016 10:32 AM, Emmanuel Dreyfus wrote: > Pranith Kumar Karampuri 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,

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

2016-07-24 Thread Emmanuel Dreyfus
Vijay Bellur wrote: > Do you have any concrete examples of problems encountered due to the > same directory stream being invoked from multiple threads? I am not sure this scenario can happen, but what we had were directory offsets reused among different DIR * opened on the

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

2016-07-23 Thread Pranith Kumar Karampuri
On Sat, Jul 23, 2016 at 8:02 PM, Emmanuel Dreyfus wrote: > Pranith Kumar Karampuri 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

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

2016-07-23 Thread Emmanuel Dreyfus
Pranith Kumar Karampuri 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

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

2016-07-23 Thread Pranith Kumar Karampuri
Emmanuel, I procrastinated too long on this :-/, It is July already :-(. I just looked at the man page in Linux and it is a bit confusing, so I am not sure how to go ahead. For readdir_r(), I see: DESCRIPTION This function is deprecated; use readdir(3) instead. The

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

2016-02-11 Thread Emmanuel Dreyfus
Juste to make sure there is no misunderstanding here: unfortunately I do not have time right now to submit a fix. It would be nice if someone else coule look at it. On Wed, Feb 10, 2016 at 01:48:52PM +, Emmanuel Dreyfus wrote: > Hi > > After obtaining a core in a regression, I noticed there

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

2016-02-10 Thread Emmanuel Dreyfus
Hi After obtaining a core in a regression, I noticed there are a few readdir() use in threaded code. This is begging for a crash, as readdir() maintains an internal state that will be trashed on concurent use. readdir_r() should be used instead. A quick search shows readdir(à usage here: