diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2017-08-22 07:58:14 +1200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-09-28 02:08:34 +0200 |
commit | 099df25f567a34bf0c159e18b62cd67b073c3002 (patch) | |
tree | b3b259d68abbafbf3099283a7261fa2caef6998e /source4/smbd/service.c | |
parent | 575f1e2bf51131709f55d565568198f56a0cbdda (diff) | |
download | samba-099df25f567a34bf0c159e18b62cd67b073c3002.tar.gz |
source4 smbd: remove global control pipe from process_standard.
The standard model uses a pipe to signal the worker processes spawned on
accept that the controlling process has terminated and that they should
shut down. This pipe is currently a static global variable in
process_standard.c.
This patch replaces that global pipe with a file descriptor passed into
the process model init functions, giving a single mechanism across all process
models. This paves the way for the addition of a pre-fork process model.
Ensuring that the correct file descriptors are closed, is difficult so
it is best do this only once rather than require the process models to
do this individually.
Notes on debugging pipe ownership:
Add code to log the process id and the file descriptor of the writeable
pipe.
run:
lsof | grep FIFO | grep samba | grep <process id>
this will produce lines like:
samba 25624 him 4w FIFO 0,10 0t0 472206 pipe
where: 4w is the file descriptor and mode and the number to the left
of "pipe" is the pipe id.
then:
lsof | grep FIFO | grep samba | grep <pipe id>
This will display all the processes with the pipe open and the mode
only the smbd master process should have it open in write mode.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Sep 28 02:08:34 CEST 2017 on sn-devel-144
Diffstat (limited to 'source4/smbd/service.c')
-rw-r--r-- | source4/smbd/service.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/smbd/service.c b/source4/smbd/service.c index 403ae74964b..61ed684d00f 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -56,13 +56,16 @@ NTSTATUS register_server_service(TALLOC_CTX *ctx, static NTSTATUS server_service_init(const char *name, struct tevent_context *event_context, struct loadparm_context *lp_ctx, - const struct model_ops *model_ops) + const struct model_ops *model_ops, + int from_parent_fd) { struct registered_server *srv; for (srv=registered_servers; srv; srv=srv->next) { if (strcasecmp(name, srv->service_name) == 0) { - return task_server_startup(event_context, lp_ctx, srv->service_name, - model_ops, srv->task_init); + return task_server_startup(event_context, lp_ctx, + srv->service_name, + model_ops, srv->task_init, + from_parent_fd); } } return NT_STATUS_INVALID_SYSTEM_SERVICE; @@ -72,9 +75,10 @@ static NTSTATUS server_service_init(const char *name, /* startup all of our server services */ -NTSTATUS server_service_startup(struct tevent_context *event_ctx, +NTSTATUS server_service_startup(struct tevent_context *event_ctx, struct loadparm_context *lp_ctx, - const char *model, const char **server_services) + const char *model, const char **server_services, + int from_parent_fd) { int i; const struct model_ops *model_ops; @@ -93,7 +97,8 @@ NTSTATUS server_service_startup(struct tevent_context *event_ctx, for (i=0;server_services[i];i++) { NTSTATUS status; - status = server_service_init(server_services[i], event_ctx, lp_ctx, model_ops); + status = server_service_init(server_services[i], event_ctx, + lp_ctx, model_ops, from_parent_fd); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to start service '%s' - %s\n", server_services[i], nt_errstr(status))); |