diff options
| author | David Disseldorp <ddiss@samba.org> | 2014-07-11 17:00:05 +0200 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2014-08-08 14:10:38 +0200 |
| commit | 4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38 (patch) | |
| tree | 13a9ffcdebbdc254b8305b1f24943a66ed49a569 /source3/smbd | |
| parent | 1e83435eac2cef03fccb4cf69ef5e0bfbd710410 (diff) | |
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>
Diffstat (limited to 'source3/smbd')
| -rw-r--r-- | source3/smbd/lanman.c | 1 | ||||
| -rw-r--r-- | source3/smbd/server.c | 20 |
2 files changed, 1 insertions, 20 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 66ab8a2013..b7c74e907b 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(); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index ec9348c34c..bc07c0f1ed 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -110,24 +110,6 @@ static void smbd_parent_conf_updated(struct messaging_context *msg, } /******************************************************************* - What to do when printcap is updated. - ********************************************************************/ - -static void smb_pcap_updated(struct messaging_context *msg, - void *private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB *data) -{ - struct tevent_context *ev_ctx = - talloc_get_type_abort(private_data, struct tevent_context); - - DEBUG(10,("Got message saying pcap was updated. Reloading.\n")); - change_to_root_user(); - delete_and_reload_printers(ev_ctx, msg); -} - -/******************************************************************* Delete a statcache entry. ********************************************************************/ @@ -894,8 +876,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete); messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug); - messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP, - smb_pcap_updated); messaging_register(msg_ctx, NULL, MSG_SMB_BRL_VALIDATE, brl_revalidate); messaging_register(msg_ctx, NULL, MSG_SMB_FORCE_TDIS, |
