1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

37992 Commits

Author SHA1 Message Date
Stefan Metzmacher
42cde0480b s3:smb2_server: make sure we prefer responses over requests on the client socket
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 16:46:43 CEST 2011 on sn-devel-104
2011-08-12 16:46:43 +02:00
Stefan Metzmacher
0d1a7fda1e s3:libsmb: keep the request order in cli_smb_req_unset_pending()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 12:36:03 CEST 2011 on sn-devel-104
2011-08-12 12:36:03 +02:00
Stefan Metzmacher
edeb41aa20 s3:libsmb: use tevent_req_defer_callback() unless there's only one request in cli_smb_received()
Callers of tevent_req_done() (or similar functions) have to return directly.
Otherwise the callback could invalidate the current stack state,
which is likely to trigger segfaults.

If there was only one pending request and we just got the response
for that one, we can use tevent_req_done() directly.

Otherwise there're more pending requests and we need to call
cli_state_receive_next() or we got the response for chained requests.
Both means that we have to use tevent_req_defer_callback().

metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
02cb2052d8 s3:libsmb: make use of cli_state_receive_next() in cli_smb_received()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
56d3c91af7 s3:libsmb: notify all request about failures in cli_smb_req_set_pending()
It's up to the caller to notify the current request,
but we have to notify all other pending requests if
we're not able to read the next response from the server.

metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
4335a4f1c6 s3:libsmb: split out cli_state_receive_next() from cli_smb_req_set_pending()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
ca567117b0 s3:libsmb: use talloc_stackframe() in cli_smb_received()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
bae9324e50 s3:libsmb: call cli_smb_req_unset_pending() before tevent_req_done() also for chained requests
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
d41d2e93f4 s3:libsmb: reset the destructor in cli_smb_req_unset_pending()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
c01b8326e0 s3:libsmb: add cli_state_notify_pending() and use it
If we got a problem on the connection we need to notify every
pending request. But we need to make use of tevent_req_defer_callback()
before tevent_req_nterror(), otherwise the callback, triggered
by tevent_req_nterror(), could invalidate the state of current caller,
which will likely cause segfaults.

metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
b4a730d353 s3:selftest: run smbtorture3 CHAIN1/CHAIN2 tests
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 09:37:04 CEST 2011 on sn-devel-104
2011-08-12 09:37:04 +02:00
Simo Sorce
d52343a967 s3-messaging: Do not register to classes we are not going to use.
Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Thu Aug 11 17:09:30 CEST 2011 on sn-devel-104
2011-08-11 17:09:30 +02:00
Simo Sorce
9f12575712 s3-messaging: Change classification of MSG_SMB_CONF_UPDATED.
smbd is not the only daemon interested in smb.conf changes. Move this
message to the GENERAL class so that all interested partied (nmbd,
winbindd, spoolssd, etc..) can receive this notification.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:58:05 +02:00
Simo Sorce
b706fd37f6 s3-messaging: Fix messaging classes.
This has been broken since ff0ac5b0 (May 2007).
Basically all messages were belonging to the General class except for CTDB
messages.
This fixed the message_send_all() function to correctly compute the class, and
fixes registrations to include all they need to cope with the fact not all
messages are of calss general (registrations rotted a bit because as long as
FLAG_MSG_GENERAL was defined the process woould receive all messages).

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:58:01 +02:00
Simo Sorce
cb1af61cb1 s3-messaging: Remove obsolete class.
The FLAG_MSG_PRINT_NOTIFY class is actually obsolete and never used, as the
only message belonging to it is not used either.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:57:55 +02:00
Michael Adam
91a45490a5 s3:build(autoconf): fix bug #8369: remove irritating "." targets when recent system libs exist
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Thu Aug 11 13:26:27 CEST 2011 on sn-devel-104
2011-08-11 13:26:27 +02:00
Volker Lendecke
38fb4df694 s3: Adapt msg_idmap.c to Samba coding conventions 2011-08-10 19:56:09 +02:00
Volker Lendecke
223fbc9c62 s3: Fix some nonempty blank lines 2011-08-10 19:56:09 +02:00
Volker Lendecke
63435f9ef2 s3: Fix some typos -- Simo, please check 2011-08-10 19:40:58 +02:00
Andreas Schneider
9eafbebf9c s3-spoolss: Fix prototypes warnings.
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:06 +02:00
Simo Sorce
c3cfa6be47 s3-printing: Do not try to force reload.
Be more correct in load printers at startup.
If async process have already started we do not need to force a reload, but we
just need to load the printers. If other process have not finished initializing
it makes no sense to try to force them as they are masking SIGHUP unitl init is
done anyway.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:06 +02:00
Simo Sorce
54aaa5a58c s3-spoolss: do not call pcap_cache_reload() directly
The background queue process is repsonsible for that.
Just reload printers if necessary or wait for a message from bq to do that.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
dd4ff4bfdd s3-printing: Add child handler to bq process
The cups backend forks a child to do asynchronous work.
We need a sigchld handler in bq to properly wait for the chilod to finish and
reap it, otherwise it hangs the forever as a zombie process.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
befc539273 s3-spoolss: Fix printers related messaging
Children were not properly receiving messages to reload printers when
the background queue process was dispatching them.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
7a07162558 s3-prefork: Fix use of child id.
Children Ids must start at 1 as 0 represent the father.
Also fix callbacks that restart logs to use a procedd global variable that
holds the Id so that they work correctly both fot the parent process and the
children.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
f00681fe9a s3-printing: make sure to block SIGHUP ...
... until we are ready to handle it.

Also make us ready as early as possible in spoolssd.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
6f682be2ae s3-spoolss: Use a global variable for the pool
This allows for setting up signal handlers earlier which is needed
for the following patch. It also simplify the code in a few places.
After all we never have more than pool active at any time during
spoolssd life span.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
b2f682a8e6 s3-printing: Allow bq process to have own logfile
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
339c106e51 s3-spoolssd: Use the child_id to open log files
This way each child has its own log file and avoid mixing all logs form all
children in the same parent log file.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
fa893e815b s3-prefork: Pass the child a child_id
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
0de09289ae s3-printing: Force pcap reload when all ready
This way we are sure the cache is primed properly and messages can be sent to
processes if necessary as all messaging has been set up.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
227551a07b s3-prefork: Return tsocket_address for client and server
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
2b33b438ba s3-prefork: Pass messaging context around too
Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
1155280a48 s3-prefork: Set up a SIGCHLD handler by default
We need to properly handle preforked children so it is better to just do that
automatically.

If the parent needs/wants to intercept SIGCHLD events it can set a callback
that will be called by the prefork code once the internal cleanup function that
checks all prefork children has been executed.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
d36a8dc896 s3:spoolssd Start spoolssd from printing_subsystem_init
Use a child for the background updater process
Forward printer update messages from spoolss to background update process.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
9ce6416673 s3-printing: Rework how the background process is started
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
0a910c9347 s3-prefork: Provide a cleanup function
This way the parent doesn't need to know how to handle dead children and
keeps all of that within the prefork abstraction.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
e0aa6eec0b s3-prefork: Inline Doxygen Documentation
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
b58d446c03 s3-prefork: better timing out semantics
If this child has no clients, let the lock functions block for 1 second,
and then immediately reschedule the operation. This means we catch the lock
as soon as possible on a free child.

If, instead, we are already serving a client, we want to be non blocking,
so we timeout immediately on getting the lock, and then we sleep a 1/10th of
a second.
This means that a busy child will be slightly slower on picking up the lock,
but we won't block the existing client from communicating with us as we
immediately react to activity on the already opened file handler.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
f6ae58f242 s3-prefork: add support for multiple listning file descriptors
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
afde4d8d83 s3-spoolssd: propagate SIGHUP to children
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
3339c9b9b4 s3-prefork: provide way to send a signal to all children
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:04 +02:00
Simo Sorce
de08cd99b2 s3-spoolssd: expand children pool when necessary
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
567ca03786 s3-prefork: provide means to expand the pool size
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
afc4dda7d0 s3-spoolssd: Use parametric option for prefork parameters
example:
spoolssd:prefork = 10💯5

will configure spoolssd to start with a minimum of 10 preforked children,
a max set to 100 children and spawns/retires 5 children at a time when
ramping up/scaling down.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
595cce89fe s3-spoolss: make listening asynchronous
This also allows to make each children serve more than one client at the same
time if necessary.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
1dd93f40c8 s3-spoolssd: Use the prefork framework in spoolssd
This should make it more scalable and able to handle easily multiple clients at
the same time.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
a1394fc934 s3-rpc_server: add termination function
This way we can act when a client disconnects.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
d67fc9c1eb s3-rpc: Expose some internal functions
This will allow to hook the prefork socket handlers to the rpc service.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00
Simo Sorce
2056d06cae s3-prefork: add way to manage number of clients per child
The allowed_clients var is a parent managed variable that tell children how
many clients they are allowed to handle at the same time. This way children
can overcommit but within parent controlled limits.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:03 +02:00