Bug 1327845

Summary: Enabling spoolssd avoids pcap_cache_reload() during "systemctl reload smb.service"
Product: Red Hat Enterprise Linux 7 Reporter: Robert Scheck <redhat-bugzilla>
Component: sambaAssignee: Andreas Schneider <asn>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: asn, gdeschner, jarrpa, rhack, srandhaw
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: samba-4.4.4-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 07:00:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Scheck 2016-04-16 19:13:17 UTC
Description of problem:
According to source3/printing/queue_process.c, sending SIGHUP triggers the
bq_sig_hup_handler() which triggers pcap_cache_reload(). This however does
not work at all once Samba is configured with spoolssd as documented in:

  https://wiki.samba.org/index.php/Setup_a_Samba_print_server

Example: Put "rpc_daemon:spoolssd = fork" and "rpc_server:spoolss = external"
into /etc/samba/smb.conf file, perform "systemctl restart smb.service". Then:

$ lpadmin -p test -v socket://test -D test -E
$ systemctl reload smb.service
$ while [ true ]; do
>   date
>   rpcclient localhost -U printadmin%printadmin -c 'enumprinters' | grep test
>   sleep 1
> done
Sa 16. Apr 02:57:00 CEST 2016
Sa 16. Apr 02:57:01 CEST 2016
Sa 16. Apr 02:57:02 CEST 2016
Sa 16. Apr 02:57:03 CEST 2016
Sa 16. Apr 02:57:04 CEST 2016
Sa 16. Apr 02:57:05 CEST 2016
Sa 16. Apr 02:57:06 CEST 2016
Sa 16. Apr 02:57:07 CEST 2016
Sa 16. Apr 02:57:08 CEST 2016
Sa 16. Apr 02:57:09 CEST 2016
Sa 16. Apr 02:57:10 CEST 2016
Sa 16. Apr 02:57:12 CEST 2016
Sa 16. Apr 02:57:13 CEST 2016
Sa 16. Apr 02:57:14 CEST 2016
Sa 16. Apr 02:57:15 CEST 2016
Sa 16. Apr 02:57:16 CEST 2016
Sa 16. Apr 02:57:17 CEST 2016
Sa 16. Apr 02:57:18 CEST 2016
Sa 16. Apr 02:57:19 CEST 2016
Sa 16. Apr 02:57:20 CEST 2016
Sa 16. Apr 02:57:21 CEST 2016
Sa 16. Apr 02:57:22 CEST 2016
Sa 16. Apr 02:57:23 CEST 2016
Sa 16. Apr 02:57:24 CEST 2016
Sa 16. Apr 02:57:25 CEST 2016
Sa 16. Apr 02:57:26 CEST 2016
Sa 16. Apr 02:57:27 CEST 2016
Sa 16. Apr 02:57:28 CEST 2016
Sa 16. Apr 02:57:29 CEST 2016
Sa 16. Apr 02:57:30 CEST 2016
Sa 16. Apr 02:57:31 CEST 2016
Sa 16. Apr 02:57:32 CEST 2016
Sa 16. Apr 02:57:34 CEST 2016
Sa 16. Apr 02:57:35 CEST 2016
Sa 16. Apr 02:57:36 CEST 2016
Sa 16. Apr 02:57:37 CEST 2016
Sa 16. Apr 02:57:38 CEST 2016
Sa 16. Apr 02:57:39 CEST 2016
Sa 16. Apr 02:57:40 CEST 2016
Sa 16. Apr 02:57:41 CEST 2016
Sa 16. Apr 02:57:42 CEST 2016
Sa 16. Apr 02:57:43 CEST 2016
Sa 16. Apr 02:57:44 CEST 2016
Sa 16. Apr 02:57:45 CEST 2016
Sa 16. Apr 02:57:46 CEST 2016
Sa 16. Apr 02:57:47 CEST 2016
Sa 16. Apr 02:57:48 CEST 2016
Sa 16. Apr 02:57:49 CEST 2016
Sa 16. Apr 02:57:50 CEST 2016
Sa 16. Apr 02:57:51 CEST 2016
Sa 16. Apr 02:57:52 CEST 2016
Sa 16. Apr 02:57:53 CEST 2016
Sa 16. Apr 02:57:54 CEST 2016
Sa 16. Apr 02:57:56 CEST 2016
Sa 16. Apr 02:57:57 CEST 2016
Sa 16. Apr 02:57:58 CEST 2016
Sa 16. Apr 02:57:59 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:00 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:01 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:02 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:03 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 02:58:04 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
^C
$ 

The cause for this is "ExecReload=/usr/bin/kill -HUP $MAINPID" in the
systemd unit file /usr/lib/systemd/system/smb.service. Thus only the main
PID of Samba is triggered for a reload, not all child processes.

Using however "ExecReload=/usr/bin/systemctl kill -s HUP %n" instead makes
it working as expected:

$ lpadmin -p test -v socket://test -D test -E
$ systemctl reload smb.service
$ while [ true ]; do
>   date
>   rpcclient localhost -U printadmin%printadmin -c 'enumprinters' | grep test
>   sleep 1
> done
Sa 16. Apr 21:09:24 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
Sa 16. Apr 21:09:25 CEST 2016
	name:[\\LOCALHOST\test]
	description:[\\LOCALHOST\test,,test]
^C
$ 

Version-Release number of selected component (if applicable):
samba-4.2.10-6.el7_2

How reproducible:
Everytime, see above and below.

Actual results:
Enabling spoolssd avoids pcap_cache_reload() during "systemctl reload 
smb.service" (until next housekeeping every 60 seconds).

Expected results:
Working pcap_cache_reload() during "systemctl reload smb.service" even
when spoolssd is enabled.

Additional info:
While this is not directly a bug in upstream Samba, it is a bug within
the systemd unit file as shipped with Samba in RHEL and Fedora.

Comment 2 Robert Scheck 2016-04-17 00:08:33 UTC
Cross-filed case 01618854 on the Red Hat customer portal.

Comment 3 Andreas Schneider 2016-06-08 13:21:40 UTC
That should be fixed by the rebase to Samba 4.4.4 looking at the code.

Comment 5 Andreas Schneider 2016-06-08 13:24:52 UTC
Only the background queue reloads the pcap cache and it has a sighup handler.

Comment 6 Robert Scheck 2016-06-08 13:27:45 UTC
What does this mean? RHEL 7.3 with Samba 4.4.x including a fix for the issue?

Comment 10 errata-xmlrpc 2016-11-04 07:00:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2468.html