summaryrefslogtreecommitdiff
path: root/source3/smbd/lanman.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2014-07-11 17:00:05 +0200
committerKarolin Seeger <kseeger@samba.org>2014-09-01 21:34:11 +0200
commit0fae4d37ab6f11496b4e2297871050dbc769f005 (patch)
treef11903bf65e308c51a59d9a7df8ae82e02594e1f /source3/smbd/lanman.c
parent83f448d7f3e6cce42a4b3070f45c84b85ec23ec0 (diff)
downloadsamba-0fae4d37ab6f11496b4e2297871050dbc769f005.tar.gz
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)
Diffstat (limited to 'source3/smbd/lanman.c')
-rw-r--r--source3/smbd/lanman.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 0a0ab6b975..d0dae36db2 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -2091,6 +2091,7 @@ static bool api_RNetShareEnum(struct smbd_server_connection *sconn,
/* Ensure all the usershares are loaded. */
become_root();
+ delete_and_reload_printers(sconn->ev_ctx, sconn->msg_ctx);
load_registry_shares();
count = load_usershare_shares(NULL, connections_snum_used);
unbecome_root();