daemons: report status to systemd even when running in foreground
authorAlexander Bokovoy <ab@samba.org>
Sat, 24 Oct 2020 13:52:43 +0000 (16:52 +0300)
committerJeremy Allison <jra@samba.org>
Mon, 26 Oct 2020 19:58:17 +0000 (19:58 +0000)
commit3e27dc4847bd35ca8914be087d5a8ca096510399
tree3ffd35275dccb3c9ca804a02e53e1192442f8054
parent183d5d63f4b40accda3b3ffc980fea391612f964
daemons: report status to systemd even when running in foreground

When systemd launches samba services, the configuration we have in
systemd service files expects that the main process (/usr/sbin/*)
would use sd_notify() to report back its status. However, we only use
sd_notify() when running become_daemon().

As a result, samba/smbd/winbindd/nmbd processes never report back its
status and the status updates from other childs (smbd, winbindd, etc)
are not accepted as we now have implied NotifyAccess=main since commit
d1740fb3d5a72cb49e30b330bb0b01e7ef3e09cc

This leads to a timeout and killing samba process by systemd. Situation
is reproducible in Fedora 33, for example.

Make sure that we have required status updates for all daemons in case
we aren't runnning in interactive mode.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14552

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Oct 26 19:58:18 UTC 2020 on sn-devel-184
source3/nmbd/nmbd.c
source3/smbd/server.c
source3/winbindd/winbindd.c
source4/smbd/server.c