smbd as a daemon

Jeremy Allison jra at samba.org
Mon Mar 24 10:02:44 MDT 2014


On Mon, Mar 24, 2014 at 05:00:10PM +0100, Andreas Schneider wrote:
> Hello,
> 
> we have an issue with systemd and smbd (maybe also winbind and nmbd). systemd 
> assumes that if the daemon starts up and returns with the exit code SUCCESS 
> that it is ready and working. In a systemd service file normally you specify 
> the PID file which is used to check if a service is running:
> 
> systemctl status smb.service
> 
> 
> The problem is that when smbd starts we check if we want to become a daemon. 
> If yes, then we fork and the parent exits with 0. Then we create some 
> directories and create the pid file. So between the exit and the creation of 
> the pid file we have a race condition.
> 
> The correct thing would be to wait in the parent util the child is done with 
> the init and then send a signal it can successfully exit.
> 
> 
> The questions what is suggested way to do this inside of smbd?
> 
> 
> Please help!

Hmmmm. Isn't this breakage inside systemd ? It's common
for a daemon to start up, fork and then exit to ensure
you've lost your controlling terminal - make you safe
to run from the command line as well as from inetd.

Doesn't this break on many other daemons as well ?

Jeremy.


More information about the samba-technical mailing list