printing: traverse_read the printer list for share updates
commitc82338f5aa013fbd0d394f5a8dced3a4eea04d31
authorDavid Disseldorp <ddiss@samba.org>
Wed, 9 Jul 2014 22:18:10 +0000 (10 00:18 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Sep 2014 18:39:19 +0000 (2 20:39 +0200)
treef64a2281d3b6c6c51c805e695cd5514c67583dae
parentd3fb60ad8bd021db1a99a813d25b31613d03dfe9
printing: traverse_read the printer list for share updates

The printcap update procedure involves the background printer process
obtaining the printcap information from the printing backend, writing
this to printer_list.tdb, and then notifying all smbd processes of the
new list. The processes then all attempt to simultaneously traverse
printer_list.tdb, in order to update their local share lists.

With a large number of printers, and a large number of per-client smbd
processes, this traversal results in significant lock contention, mostly
due to the fact that the traversal is unnecessarily done with an
exclusive (write) lock on the printer_list.tdb database.

This commit changes the share update code path to perform a read-only
traversal.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652

Reported-by: Alex K <korobkin+samba@gmail.com>
Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 1e83435eac2cef03fccb4cf69ef5e0bfbd710410)
source3/printing/load.c
source3/printing/pcap.c
source3/printing/pcap.h
source3/printing/printer_list.c
source3/printing/printer_list.h