[PATCH] Remove all uses of talloc_autofree_context() from our code (except for test)

Jeremy Allison jra at samba.org
Wed Jul 26 19:47:11 UTC 2017

On Wed, Jul 26, 2017 at 05:53:13PM +0200, Volker Lendecke wrote:
> On Wed, Jul 26, 2017 at 08:43:29AM -0700, Jeremy Allison wrote:
> > On Wed, Jul 26, 2017 at 08:41:14AM +0200, Volker Lendecke wrote:
> > > On Tue, Jul 25, 2017 at 01:47:20PM -0700, Jeremy Allison wrote:
> > > > Thinking about it some more, you're actually correct about
> > > > this improving the libsmbclient libs without the null tracking
> > > > removal change - the gnome VFS programs that use libsmbclient
> > > > don't turn on null tracking. So I may have more room to experiment
> > > > there..
> > > 
> > > libsmbclient depends on so much stuff that I believe this is hopeless.
> > > For libsmbclient I believe that we need to have a separate compatible
> > > ABI layer that is thread-safe but feeds the requests into our code
> > > under a mutex. Much like source3/libsmb/pylibsmb.c does it.  From
> > > there we can then add parallelism. Like the Linux kernel did ages ago
> > > with its BKL removal efforts.
> > 
> > I'm not sure it's so hopeless. To make progress we need
> > a BKL around the entry points to libsmbclient, and then
> > we can slowly shrink the area under the lock.
> > 
> > Or did I just state the same thing as you said in a different way
> > (I think I probably did :-).
> You want multiple threads to utilize the async SMB features. Thread A
> sitting in an open should not block thread B doing a readdir. Thread B
> should be allowed to send and receive its readdir on the same
> connection while thread A waits for its open to return. That's what
> the python binding does. A big lock around all the synchronous entry
> points would prevent this I believe.

To be honest I think doing this via multiple threads at the
library calling level creating multiple libsmbclient contexts
(i.e. multiple TCP connections) would probably be easier to
initially implement for us and work just as well for the
Gnome VFS. That way we have on big lock around the inital
context create and setup, and then a context specific lock
only allowing one outstanding call into the library on
that context.

More information about the samba-technical mailing list