[PATCH v2 0/9] printing: improve printcap update CPU usage

David Disseldorp ddiss at samba.org
Thu Aug 7 09:40:31 MDT 2014


This patch-set attempts to address bug 10652: Samba consumes a lot of
CPU when re-reading printcap info.

It does so with the following changes to the printcap update procedure:
- Use traverse_read for printer list share updates, instead of exclusive
  (write locked) traversals. This significantly reduces printer_list.tdb
  lock contention.
- As suggested by Volker, reload per-client smbd printer share
  inventories when needed, rather than immediately after every printer
  list update.
  - If the printer list has not changed since the previous reload, then
    skip the printer share inventory update.
- Split delete_and_reload_printers() functionality into two functions
  such that per-client smbd processes do not perform registry.tdb
  updates or printer unpublishing. This is now only performed by the
  single process that performs the printer list update.

Feedback appreciated.

Cheers, David

--

Changes since V1 (Thanks for the review, Jeremy and Andreas):
- Reload the printer list on open, to support clients that do not
  enumerate beforehand, e.g. cupsaddsmb.
- Reload the printer list on RAP NetShareEnum requests.
- Remove duplicate snum_is_shared_printer() function.
- Move delete_and_reload_printers_full() into queue_process.c.

The following changes since commit 4639f6d7bab9d8d6ee46bf5c65ff73a17a56cb17:

  docs: Fix typos in smb.conf (inherit acls) (2014-08-07 00:52:42 +0200)

are available in the git repository at:

  git://git.samba.org/ddiss/samba.git printer_list_traverse_read_when_changed_notrans_master_v2

for you to fetch changes up to fbd0d9f2d0db80f75ad76a96a754478db7164ece:

  printing: reload printer shares on OpenPrinter (2014-08-07 12:26:58 +0200)

----------------------------------------------------------------
David Disseldorp (9):
      printing: traverse_read the printer list for share updates
      printing: only reload printer shares on client enum
      printing: reload printer_list.tdb from in memory list
      printing: remove pcap_cache_add()
      printing: return last change time with pcap_cache_loaded()
      smbd: only reprocess printer_list.tdb if it changed
      server: remove duplicate snum_is_shared_printer()
      smbd: split printer reload processing
      printing: reload printer shares on OpenPrinter

 source3/printing/load.c                     |   4 ++--
 source3/printing/pcap.c                     |  54 ++++++++++++++++++++++++++----------------------------
 source3/printing/pcap.h                     |  13 ++++++-------
 source3/printing/print_aix.c                |  17 ++++++++++++++---
 source3/printing/print_iprint.c             |  16 ++++++++++------
 source3/printing/print_standard.c           |   8 ++++++--
 source3/printing/print_svid.c               |  11 +++++++----
 source3/printing/printer_list.c             |  17 +++++++++++------
 source3/printing/printer_list.h             |   4 ++--
 source3/printing/queue_process.c            | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 source3/printing/spoolssd.c                 |  38 +++++++-------------------------------
 source3/rpc_server/spoolss/srv_spoolss_nt.c |  30 ++++++++++++++++++++----------
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c   |   1 +
 source3/smbd/lanman.c                       |   1 +
 source3/smbd/proto.h                        |   1 +
 source3/smbd/server.c                       |  20 --------------------
 source3/smbd/server_reload.c                |  74 +++++++++++++++++++++++++++++---------------------------------------------
 17 files changed, 241 insertions(+), 170 deletions(-)




More information about the samba-technical mailing list