[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1034-g786447d

Jeremy Allison jra at samba.org
Tue Apr 14 17:53:38 GMT 2009


On Tue, Apr 14, 2009 at 05:45:37PM +0000, simo wrote:
> On Tue, 2009-04-14 at 09:24 -0700, Jeremy Allison wrote:
> > On Tue, Apr 14, 2009 at 03:55:13PM +1000, Andrew Bartlett wrote:
> > > On Tue, 2009-04-14 at 07:49 +0200, Volker Lendecke wrote:
> > > > On Mon, Apr 13, 2009 at 11:05:16PM -0500, Andrew Bartlett wrote:
> > > > > -	if (!push_ucs2_allocate(&buffer, src, &size)) {
> > > > > +	if (!push_ucs2_talloc(NULL, &buffer, src, &size)) {
> > > > 
> > > > Any reason why you don't use talloc_tos() in your patches?
> > > > Is there any flaw with talloc_stack.c that I should know
> > > > about?
> > > 
> > > I did, in most of the places where it seemed reasonable (such as was
> > > indicated by similar use in that context).  The rest I just did the most
> > > simple replacement possible, to avoid introducing inadvertent errors.
> > 
> > Please go back and replace the _talloc(NULL,...) allocations
> > with talloc_tos(). The problem is _talloc(NULL,...) cannot
> > be thread safe, whereas talloc_tos() will be.
> 
> Uhmm why talloc(NULL, can't be thread safe ?
> It is generating a new context from scratch so why would it be
> problematic?
> 
> Note: I am not advocating to not use talloc_tos(), just wondering why a
> NULL context would make it not thread safe.

Because it has to add the pointer onto globally
linked list, a static "HEAD" pointer inside the
talloc library. Now I could add a mutex around
that inside talloc, but I'm pretty sure we don't
want to add the SMB_THREAD_XX calls inside talloc.

I think talloc is thread safe so long as you avoid the
NULL context.

Jeremy.


More information about the samba-technical mailing list