printing: only reload printer shares on client enum
commita97c2dbb87f614e3a38763c3fd7007bc76057a03
authorDavid Disseldorp <ddiss@samba.org>
Fri, 11 Jul 2014 15:00:05 +0000 (11 17:00 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Sep 2014 18:39:19 +0000 (2 20:39 +0200)
tree12747c375e083311c99a3ee6f61a833a3e09d21b
parentc82338f5aa013fbd0d394f5a8dced3a4eea04d31
printing: only reload printer shares on client enum

Currently, automatic printer share updates are handled in the following
way:
- Background printer process (BPP) forked on startup
- Parent smbd and per-client children await MSG_PRINTER_PCAP messages
- BPP periodically polls the printing backend for printcap data
- printcap data written to printer_list.tdb
- MSG_PRINTER_PCAP sent to all smbd processes following update
- smbd processes all read the latest printer_list.tdb data, and update
  their share listings

This procedure is not scalable, as all smbd processes hit
printer_list.tdb in parallel, resulting in a large spike in CPU usage.

This change sees smbd processes only update their printer share lists
only when a client asks for this information, e.g. via NetShareEnum or
EnumPrinters.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652

Suggested-by: Volker Lendecke <vl@samba.org>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38)
source3/printing/spoolssd.c
source3/rpc_server/spoolss/srv_spoolss_nt.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/lanman.c
source3/smbd/server.c