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/rpc_server | |
| parent | 1e83435eac2cef03fccb4cf69ef5e0bfbd710410 (diff) | |
| download | samba-4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38.tar.gz samba-4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38.tar.xz samba-4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38.zip | |
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/rpc_server')
| -rw-r--r-- | source3/rpc_server/spoolss/srv_spoolss_nt.c | 11 | ||||
| -rw-r--r-- | source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 760c924d80..b8cae89e97 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -4312,7 +4312,7 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx, uint32_t *count_p) { int snum; - int n_services = lp_numservices(); + int n_services; union spoolss_PrinterInfo *info = NULL; uint32_t count = 0; WERROR result = WERR_OK; @@ -4324,6 +4324,15 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx, return WERR_NOMEM; } + /* + * printer shares are only updated on client enumeration. The background + * printer process updates printer_list.tdb at regular intervals. + */ + become_root(); + delete_and_reload_printers(server_event_context(), msg_ctx); + unbecome_root(); + + n_services = lp_numservices(); *count_p = 0; *info_p = NULL; diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index e030b98ad0..11abc6c838 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -548,6 +548,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p, /* Ensure all the usershares are loaded. */ become_root(); + delete_and_reload_printers(server_event_context(), p->msg_ctx); load_usershare_shares(NULL, connections_snum_used); load_registry_shares(); num_services = lp_numservices(); |
