talloc_tos and thread safety

Jeremy Allison jra at samba.org
Mon Apr 20 08:02:52 GMT 2009


On Mon, Apr 20, 2009 at 11:08:02AM +1000, tridge at samba.org wrote:
> 
> In Samba3 we call talloc_enable_leak_report() in smbd if DEBUGLEVEL >=
> 9 and smbd is being run interactively. In Samba4 it is enabled if you
> use the --leak-report command line option.

talloc_enable_null_tracking() is called directly from the old
talloc_init() call, which is still heavily used in the Samba3
code. So these cases are not the only ones.

> Right now talloc_tos() is not thread safe, so switching to use
> talloc_tos() from talloc(NULL. ...) will actually make the code not
> thread safe with default command line options, whereas keeping
> talloc(NULL, ...) would keep it thread safe.

I'm using talloc_tos() as my test bed for thread-safety,
(check out the code in master right now). Just finishing
the initialization code now. My intent is that talloc_tos() be 
thread safe as the first part of fixing our threading issues.

> Perhaps there are other reasons for using talloc_tos(), but I don't
> think thread safety is one of them.

There are indeed other reasons for using it :-).

Jeremy.


More information about the samba-technical mailing list