diff options
author | David Disseldorp <ddiss@suse.de> | 2010-12-23 12:14:21 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-01-07 15:37:39 -0800 |
commit | 0b188e7784a3f58810f871bf63d10d8a691ecbae (patch) | |
tree | 997ccf3bb3962549f814d82af4e54692880bcaee /source3/web | |
parent | 04248c2cfaa5a1728ef58fc8ca231fd1309ca694 (diff) | |
download | samba-0b188e7784a3f58810f871bf63d10d8a691ecbae.tar.gz samba-0b188e7784a3f58810f871bf63d10d8a691ecbae.tar.bz2 samba-0b188e7784a3f58810f871bf63d10d8a691ecbae.zip |
s3-printing: Initiate pcap reload from parent smbd
Since commit 7022554, smbds share a printcap cache (printer_list.tdb),
therefore ordering of events between smbd processes is important when
updating printcap cache information. Consider the following two process
example:
1) smbd1 receives HUP or printcap cache time expiry
2) smbd1 checks whether pcap needs refresh, it does
3) smbd1 marks pcap as refreshed
4) smbd1 forks child1 to obtain cups printer info
5) smbd2 receives HUP or printcap cache time expiry
6) smbd2 checks whether pcap needs refresh, it does not (due to step 3)
7) smbd2 reloads printer shares prior to child1 completion (stale pcap)
8) child1 completion, pcap cache (printer_list.tdb) is updated by smbd1
9) smbd1 reloads printer shares based on new pcap information
In this case both smbd1 and smbd2 are reliant on the pcap update
performed on child1 completion.
The prior commit "reload shares after pcap cache fill" ensures that
smbd1 only reloads printer shares following pcap update, however smbd2
continues to present shares based on stale pcap data.
This commit addresses the above problem by driving pcap cache and
printer share updates from the parent smbd process.
1) smbd0 (parent) receives a HUP or printcap cache time expiry
2) smbd0 forks child0 to obtain cups printer info
3) child0 completion, pcap cache (printer_list.tdb) is updated by smbd0
4) smbd0 reloads printer shares
5) smbd0 notifies child smbds of pcap update via message_send_all()
6) child smbds read fresh pcap data and reload printer shares
This architecture has the additional advantage that only a single
process (the parent smbd) requests printer information from the printcap
backend.
Use time_mono in housekeeping functions As suggested by Björn Jacke.
Diffstat (limited to 'source3/web')
-rw-r--r-- | source3/web/swat.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c index 1cbecd4675..93fe36827c 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -30,6 +30,7 @@ #include "includes.h" #include "popt_common.h" #include "web/swat_proto.h" +#include "printing/pcap.h" static int demo_mode = False; static int passwd_only = False; @@ -491,8 +492,10 @@ static int save_reload(int snum) return 0; } iNumNonAutoPrintServices = lp_numservices(); - pcap_cache_reload(server_event_context(), server_messaging_context(), - &load_printers); + if (pcap_cache_loaded()) { + load_printers(server_event_context(), + server_messaging_context()); + } return 1; } @@ -1436,8 +1439,10 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid) reopen_logs(); load_interfaces(); iNumNonAutoPrintServices = lp_numservices(); - pcap_cache_reload(server_event_context(), server_messaging_context(), - &load_printers); + if (pcap_cache_loaded()) { + load_printers(server_event_context(), + server_messaging_context()); + } cgi_setup(get_dyn_SWATDIR(), !demo_mode); |