Many smbd forked processes are not resetting am_parent to NULL

Jeremy Allison jra at samba.org
Wed Apr 22 12:29:22 MDT 2015


On Wed, Apr 22, 2015 at 12:02:55PM +0200, Ralph Böhme wrote:
> On Wed, Apr 15, 2015 at 09:06:45AM -0700, Jeremy Allison wrote:
> > On Wed, Apr 15, 2015 at 11:28:11AM +0200, Ralph Böhme wrote:
> > > Hi folks,
> > > 
> > > exit_server_common() checks the am_parent global and does a few things
> > > differently depending whether am_parent is NULL or not.
> > > 
> > > What are the supposed semantics? If I'm not mislead am_parent should
> > > be non NULL in the main smbd process and NULL in any forked child, be
> > > it a forked sesssion smbd process or some other forked subsystem.
> > > 
> > > The thing is, only smbd sessions childs reset am_parent to NULL as
> > > does the scavenger child, other subsystems like the printing subsystem
> > > seem to miss this step.
> > > 
> > > Shouldn't we basically set am_parent to NULL in anything that forks
> > > from the main smbd?
> > 
> > Yes.
> > 
> > > I'm currently looking at adding some cleanup code to
> > > exit_server_common() that is supposed to execute some code only in the
> > > am_parent != NULL case in the main smbd process. At the moment the
> > > code gets executed too from the printing subsystem. :)
> > 
> > That's a sad thing :-(.
> > 
> > > Happy to provide a patch that fixes this if I'm right about this.
> > 
> > Please do :-).
> 
> patch attached. Please review&push if ok. Thanks!
> -Ralph

LGTM - pushed. Thanks !


More information about the samba-technical mailing list