create_conn_struct_tos() and connection re-use

Andrew Bartlett abartlet at samba.org
Sat Jun 23 02:55:02 UTC 2018


On Fri, 2018-06-22 at 15:32 -0700, Jeremy Allison wrote:
> On Sat, Jun 23, 2018 at 10:13:56AM +1200, Andrew Bartlett wrote:
> > 
> > > As you're doing a specific set of operations on a specific share,
> > > seems to me it might just be easier to create a new python
> > > wrapper call that creates a frame, gets the service and then
> > > does the required calls from parameters passed into it.
> > > 
> > > Why call out to python at all, just do it all in C ?
> > 
> > We set a different ACL on each file depending on the matching ACL in
> > the LDAP entry for the matching group policy.
> > 
> > https://git.samba.org/?p=samba.git;a=blob;f=python/samba/provision/__in
> > it__.py;h=f36f277742e6f2e2d87efba59c4573970f57f9a7;hb=fe9e62935c459e4cd
> > ab0cefea1412614dd1969a8#l1550
> > 
> > See set_gpos_acl(), set_dirs_acl(), setsysvolacl() and tell me you want
> > to re-implement in C ;-)
> 
> Well this is just hard then with the current way
> the python code is structured, sorry :-).

Sure :-)

> But using talloc_tos() in the python wrappers
> doesn't make this any harder than it already
> was using the original create_conn_struct()
> code. You could try using talloc_move() to
> move off the frame onto a long-term context
> that you have to return to python somehow,
> and then explicitly free the object when
> you're done.

OK.  I'm not sure that is entirely safe - isn't the point that we want
the destructor definitively called pair-wise with the create?  That
isn't really a great match for python objects, we could have two of
them for example. 

> But the existing python code is structured such that
> calling into the VFS fileserver calls creates/operated/frees
> the connection object. The recent changes haven't changed
> that.

Sure!  Just mining for info for the next iteration, because creating
and destroying a connection 2000 times in a loop seems excessive.  

I really appriciate the information here, as typically for Samba, what
looked like a really simple optimisation turns out to be a bit more
subtle and a bit more complex :-).  

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list