The branch, v3-5-test has been updated via f0e3978 s3: Prune the printername cache when a printer is deleted. from b40ce05 s3:winbindd: catch lookup_names/sids schannel errors over ncacn_ip_tcp (bug #7944)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test - Log ----------------------------------------------------------------- commit f0e39788d88c4e29d9724288565241c71b860bb2 Author: Volker Lendecke <v...@samba.org> Date: Mon Sep 6 20:58:45 2010 -0700 s3: Prune the printername cache when a printer is deleted. Signed-off-by: Andreas Schneider <a...@samba.org> Fix bug #7656 (Scalability problem with hundreds of printers). ----------------------------------------------------------------------- Summary of changes: source3/rpc_server/srv_spoolss_nt.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 2a113e4..2177821 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -140,6 +140,8 @@ static int nt_printq_status(int v) return 0; } +static void prune_printername_cache(void); + /*************************************************************************** Disconnect from the client ****************************************************************************/ @@ -328,6 +330,7 @@ static WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const c static WERROR delete_printer_handle(pipes_struct *p, struct policy_handle *hnd) { Printer_entry *Printer = find_printer_index_by_hnd(p, hnd); + WERROR result; if (!Printer) { DEBUG(2,("delete_printer_handle: Invalid handle (%s:%u:%u)\n", @@ -355,8 +358,13 @@ static WERROR delete_printer_handle(pipes_struct *p, struct policy_handle *hnd) return WERR_BADFID; } - return delete_printer_hook(p->mem_ctx, p->server_info->ptok, - Printer->sharename ); + result = delete_printer_hook(p->mem_ctx, p->server_info->ptok, + Printer->sharename); + if (!W_ERROR_IS_OK(result)) { + return result; + } + prune_printername_cache(); + return WERR_OK; } /**************************************************************************** @@ -414,6 +422,17 @@ static bool set_printer_hnd_printertype(Printer_entry *Printer, const char *hand return true; } +static void prune_printername_cache_fn(const char *key, const char *value, + time_t timeout, void *private_data) +{ + gencache_del(key); +} + +static void prune_printername_cache(void) +{ + gencache_iterate(prune_printername_cache_fn, NULL, "PRINTERNAME/*"); +} + /**************************************************************************** Set printer handle name.. Accept names like \\server, \\server\printer, \\server\SHARE, & "\\server\,XcvMonitor Standard TCP/IP Port" See -- Samba Shared Repository